Merge lp:~cemil-azizoglu/mir/fix-mesa-native-surface-tests into lp:mir
- fix-mesa-native-surface-tests
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Brandon Schaefer |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3686 |
Proposed branch: | lp:~cemil-azizoglu/mir/fix-mesa-native-surface-tests |
Merge into: | lp:mir |
Diff against target: |
138 lines (+29/-19) 2 files modified
src/platforms/mesa/include/native_buffer.h (+2/-0) tests/unit-tests/platforms/mesa/client/test_native_surface.cpp (+27/-19) |
To merge this branch: | bzr merge lp:~cemil-azizoglu/mir/fix-mesa-native-surface-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Brandon Schaefer (community) | Approve | ||
Daniel van Vugt | Approve | ||
Review via email: mp+304577@code.launchpad.net |
Commit message
These tests pass when they should fail. This MP fixes that so they pass for the right reasons.
Description of the change
These tests currently pass when they should fail because
1- our code catches the thrown (legit) exception
2- return value from the catch-clause isn't checked by the test
This MP fixes the reason for the exception and also checks the return values.
Mir CI Bot (mir-ci-bot) wrote : | # |
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3683
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3684
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel van Vugt (vanvugt) wrote : | # |
Just worth noting before anyone complains:
EXPECT_
has recently been changed in upstream gtest to:
EXPECT_EQ(a, b)
so there is no right or wrong way any more. Although I don't think this change has reached Ubuntu yet.
Daniel van Vugt (vanvugt) wrote : | # |
Sure.
Just nits:
* stdlib.h should probably be cstdlib
* namespace foo=bar probably should have spaces for consistency. And alignment for beauty :)
Daniel van Vugt (vanvugt) wrote : | # |
And
* MIR_MESA_
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3685
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3685
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3685
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3685
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3685
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3685
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Brandon Schaefer (brandontschaefer) wrote : | # |
lgtm
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3685
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'src/platforms/mesa/include/native_buffer.h' |
2 | --- src/platforms/mesa/include/native_buffer.h 2016-08-03 18:07:27 +0000 |
3 | +++ src/platforms/mesa/include/native_buffer.h 2016-09-02 16:34:22 +0000 |
4 | @@ -20,6 +20,8 @@ |
5 | #define MIR_GRAPHICS_MESA_NATIVE_BUFFER_H_ |
6 | |
7 | #include <mir_toolkit/mir_native_buffer.h> |
8 | + |
9 | +#include <cstdlib> |
10 | #include <gbm.h> |
11 | |
12 | namespace mir |
13 | |
14 | === modified file 'tests/unit-tests/platforms/mesa/client/test_native_surface.cpp' |
15 | --- tests/unit-tests/platforms/mesa/client/test_native_surface.cpp 2016-05-03 06:55:25 +0000 |
16 | +++ tests/unit-tests/platforms/mesa/client/test_native_surface.cpp 2016-09-02 16:34:22 +0000 |
17 | @@ -16,19 +16,21 @@ |
18 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
19 | */ |
20 | |
21 | +#include "src/platforms/mesa/include/native_buffer.h" |
22 | #include "src/platforms/mesa/client/native_surface.h" |
23 | #include "mir/client_buffer.h" |
24 | #include "mir/test/doubles/mock_egl_native_surface.h" |
25 | #include "mir/test/doubles/mock_client_buffer.h" |
26 | - |
27 | +#include "mir/test/fake_shared.h" |
28 | #include <gmock/gmock.h> |
29 | #include <gtest/gtest.h> |
30 | |
31 | -namespace mtd=mir::test::doubles; |
32 | -namespace mcl=mir::client; |
33 | -namespace mcl=mir::client; |
34 | -namespace mclg=mir::client::mesa; |
35 | -namespace geom=mir::geometry; |
36 | +namespace mt = mir::test; |
37 | +namespace mtd = mt::doubles; |
38 | +namespace mcl = mir::client; |
39 | +namespace mclg = mcl::mesa; |
40 | +namespace mg = mir::graphics; |
41 | +namespace geom = mir::geometry; |
42 | |
43 | class MesaClientNativeSurfaceTest : public ::testing::Test |
44 | { |
45 | @@ -44,10 +46,16 @@ |
46 | .WillByDefault(Return(surf_params)); |
47 | ON_CALL(mock_surface, get_current_buffer()) |
48 | .WillByDefault(Return( |
49 | - std::make_shared<NiceMock<mtd::MockClientBuffer>>())); |
50 | + mt::fake_shared(mock_buffer))); |
51 | + ON_CALL(mock_buffer, native_buffer_handle()) |
52 | + .WillByDefault(Return( |
53 | + mt::fake_shared(native_buffer))); |
54 | } |
55 | |
56 | MirSurfaceParameters surf_params; |
57 | + const char* error_msg = "thrown as part of test"; |
58 | + mg::NativeBuffer native_buffer; |
59 | + testing::NiceMock<mtd::MockClientBuffer> mock_buffer; |
60 | testing::NiceMock<mtd::MockEGLNativeSurface> mock_surface; |
61 | mclg::NativeSurface native_surface{mock_surface}; |
62 | }; |
63 | @@ -55,7 +63,7 @@ |
64 | TEST_F(MesaClientNativeSurfaceTest, basic_parameters) |
65 | { |
66 | MirSurfaceParameters params; |
67 | - native_surface.surface_get_parameters(&native_surface, ¶ms); |
68 | + EXPECT_EQ(MIR_MESA_TRUE, native_surface.surface_get_parameters(&native_surface, ¶ms)); |
69 | EXPECT_EQ(surf_params.width, params.width); |
70 | EXPECT_EQ(surf_params.height, params.height); |
71 | EXPECT_EQ(surf_params.pixel_format, params.pixel_format); |
72 | @@ -72,7 +80,7 @@ |
73 | EXPECT_CALL(mock_surface, get_current_buffer()) |
74 | .Times(1); |
75 | |
76 | - native_surface.surface_advance_buffer(&native_surface, &buffer_package); |
77 | + EXPECT_EQ(MIR_MESA_TRUE, native_surface.surface_advance_buffer(&native_surface, &buffer_package)); |
78 | } |
79 | |
80 | TEST_F(MesaClientNativeSurfaceTest, basic_advance) |
81 | @@ -88,8 +96,8 @@ |
82 | EXPECT_CALL(mock_surface, get_current_buffer()) |
83 | .Times(1); |
84 | |
85 | - native_surface.surface_advance_buffer(&native_surface, &buffer_package); |
86 | - native_surface.surface_advance_buffer(&native_surface, &buffer_package); |
87 | + EXPECT_EQ(MIR_MESA_TRUE, native_surface.surface_advance_buffer(&native_surface, &buffer_package)); |
88 | + EXPECT_EQ(MIR_MESA_TRUE, native_surface.surface_advance_buffer(&native_surface, &buffer_package)); |
89 | } |
90 | |
91 | TEST_F(MesaClientNativeSurfaceTest, swapinterval_request) |
92 | @@ -102,8 +110,8 @@ |
93 | EXPECT_CALL(mock_surface, request_and_wait_for_configure(mir_surface_attrib_swapinterval,1)) |
94 | .InSequence(seq); |
95 | |
96 | - native_surface.set_swapinterval(0); |
97 | - native_surface.set_swapinterval(1); |
98 | + EXPECT_EQ(MIR_MESA_TRUE, native_surface.set_swapinterval(0)); |
99 | + EXPECT_EQ(MIR_MESA_TRUE, native_surface.set_swapinterval(1)); |
100 | } |
101 | |
102 | TEST_F(MesaClientNativeSurfaceTest, swapinterval_unsupported_request) |
103 | @@ -119,10 +127,10 @@ |
104 | using namespace testing; |
105 | |
106 | EXPECT_CALL(mock_surface, get_current_buffer()) |
107 | - .WillOnce(Throw(std::runtime_error(""))); |
108 | + .WillOnce(Throw(std::runtime_error(error_msg))); |
109 | |
110 | MirBufferPackage buffer_package; |
111 | - EXPECT_THAT(native_surface.advance_buffer(&buffer_package), Eq(MIR_MESA_FALSE)); |
112 | + EXPECT_EQ(MIR_MESA_FALSE, native_surface.advance_buffer(&buffer_package)); |
113 | } |
114 | |
115 | TEST_F(MesaClientNativeSurfaceTest, returns_error_on_get_parameters_failure) |
116 | @@ -130,10 +138,10 @@ |
117 | using namespace testing; |
118 | |
119 | EXPECT_CALL(mock_surface, get_parameters()) |
120 | - .WillOnce(Throw(std::runtime_error(""))); |
121 | + .WillOnce(Throw(std::runtime_error(error_msg))); |
122 | |
123 | MirSurfaceParameters surface_params; |
124 | - EXPECT_THAT(native_surface.get_parameters(&surface_params), Eq(MIR_MESA_FALSE)); |
125 | + EXPECT_EQ(MIR_MESA_FALSE, native_surface.get_parameters(&surface_params)); |
126 | } |
127 | |
128 | TEST_F(MesaClientNativeSurfaceTest, returns_error_on_set_swap_interval_failure) |
129 | @@ -141,7 +149,7 @@ |
130 | using namespace testing; |
131 | |
132 | EXPECT_CALL(mock_surface, request_and_wait_for_configure(_,_)) |
133 | - .WillOnce(Throw(std::runtime_error(""))); |
134 | + .WillOnce(Throw(std::runtime_error(error_msg))); |
135 | |
136 | - EXPECT_THAT(native_surface.set_swapinterval(0), Eq(MIR_MESA_FALSE)); |
137 | + EXPECT_EQ(MIR_MESA_FALSE, native_surface.set_swapinterval(0)); |
138 | } |
FAILED: Continuous integration, rev:3683 /mir-jenkins. ubuntu. com/job/ mir-ci/ 1600/ /mir-jenkins. ubuntu. com/job/ build-mir/ 2002/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/2062 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 2053 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 2053 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 2053 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= yakkety/ 2028 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= yakkety/ 2028/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2028 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2028/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= yakkety/ 2028 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= yakkety/ 2028/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 2028/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 2028/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2028 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2028/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 1600/rebuild
https:/