Mir

Merge lp:~mir-team/mir/set-state-remove-mir-wait into lp:mir

Proposed by Brandon Schaefer
Status: Rejected
Rejected by: Brandon Schaefer
Proposed branch: lp:~mir-team/mir/set-state-remove-mir-wait
Merge into: lp:mir
Prerequisite: lp:~mir-team/mir/remove-mir-wait-handle-persistent-id
Diff against target: 255 lines (+74/-46)
6 files modified
include/client/mir_toolkit/mir_surface.h (+2/-3)
src/client/mir_surface_api.cpp (+20/-11)
tests/acceptance-tests/test_client_library.cpp (+29/-20)
tests/acceptance-tests/test_client_surface_events.cpp (+10/-6)
tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp (+8/-4)
tests/acceptance-tests/test_surface_modifications.cpp (+5/-2)
To merge this branch: bzr merge lp:~mir-team/mir/set-state-remove-mir-wait
Reviewer Review Type Date Requested Status
Cemil Azizoglu (community) Needs Fixing
Alan Griffiths Needs Information
Mir CI Bot continuous-integration Needs Fixing
Review via email: mp+314755@code.launchpad.net

Commit message

Remove the wait handle for set_state and use the old version for tests.

Description of the change

Remove the wait handle for set_state and use the old version for tests.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3936
https://mir-jenkins.ubuntu.com/job/mir-ci/2698/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3504/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3572
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3562
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3562
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/3562
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3531
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3531/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3531
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3531/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3531/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3531
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3531/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3531
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3531/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3531
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3531/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2698/rebuild

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

Using the old version seems like storing up problems for later.

/1/ We should have tests that validate the new versions.

/2/ While the old versions do need tests in this release, they are going to be deleted in 0.1.

I'd like to see corresponding tests covering both new and old APIs (and the latter tests can simply be deleted with the APIs).

review: Needs Information
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

I agree with Alan.

We need to port the instances where this API is used to the new way including the tests. In the process of doing that we'll eliminate the possibility of releasing something that isn't useful/useable. We won't know that until/unless we do the work ourselves.

Don't worry about the time too much. Let's do the right thing.

review: Needs Fixing

Unmerged revisions

3936. By Brandon Schaefer

* Remove mir_wait_handle

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/client/mir_toolkit/mir_surface.h'
--- include/client/mir_toolkit/mir_surface.h 2017-01-13 22:52:30 +0000
+++ include/client/mir_toolkit/mir_surface.h 2017-01-13 22:52:30 +0000
@@ -678,10 +678,9 @@
678 * Change the state of a window.678 * Change the state of a window.
679 * \param [in] window The window to operate on679 * \param [in] window The window to operate on
680 * \param [in] state The new state of the window680 * \param [in] state The new state of the window
681 * \return A wait handle that can be passed to mir_wait_for
682 */681 */
683MirWaitHandle* mir_window_set_state(MirWindow* window,682void mir_window_set_state(MirWindow* window,
684 MirWindowState state);683 MirWindowState state);
685684
686/**685/**
687 * Get the current state of a window.686 * Get the current state of a window.
688687
=== modified file 'src/client/mir_surface_api.cpp'
--- src/client/mir_surface_api.cpp 2017-01-13 22:52:30 +0000
+++ src/client/mir_surface_api.cpp 2017-01-13 22:52:30 +0000
@@ -528,6 +528,23 @@
528 }528 }
529}529}
530530
531static MirWaitHandle* mir_window_set_state_helper(
532 MirWindow* window,
533 MirWindowState state)
534{
535 mir::require(mir_window_is_valid(window));
536
537 try
538 {
539 return window->configure(mir_window_attrib_state, state);
540 }
541 catch (std::exception const& ex)
542 {
543 MIR_LOG_UNCAUGHT_EXCEPTION(ex);
544 return nullptr;
545 }
546}
547
531class WindowSync548class WindowSync
532{549{
533public:550public:
@@ -657,17 +674,9 @@
657 return type;674 return type;
658}675}
659676
660MirWaitHandle* mir_window_set_state(MirWindow* window, MirWindowState state)677void mir_window_set_state(MirWindow* window, MirWindowState state)
661{678{
662 try679 mir_window_set_state_helper(window, state);
663 {
664 return window ? window->configure(mir_window_attrib_state, state) : nullptr;
665 }
666 catch (std::exception const& ex)
667 {
668 MIR_LOG_UNCAUGHT_EXCEPTION(ex);
669 return nullptr;
670 }
671}680}
672681
673MirWindowState mir_window_get_state(MirWindow* window)682MirWindowState mir_window_get_state(MirWindow* window)
@@ -1189,7 +1198,7 @@
11891198
1190MirWaitHandle* mir_surface_set_state(MirSurface* surf, MirSurfaceState state)1199MirWaitHandle* mir_surface_set_state(MirSurface* surf, MirSurfaceState state)
1191{1200{
1192 return mir_window_set_state(surf, static_cast<MirWindowState>(state));1201 return mir_window_set_state_helper(surf, static_cast<MirWindowState>(state));
1193}1202}
11941203
1195MirSurfaceState mir_surface_get_state(MirSurface* surf)1204MirSurfaceState mir_surface_get_state(MirSurface* surf)
11961205
=== modified file 'tests/acceptance-tests/test_client_library.cpp'
--- tests/acceptance-tests/test_client_library.cpp 2017-01-12 16:45:44 +0000
+++ tests/acceptance-tests/test_client_library.cpp 2017-01-13 22:52:30 +0000
@@ -246,14 +246,17 @@
246 {246 {
247 for (int i = 0; i < 10; i++)247 for (int i = 0; i < 10; i++)
248 {248 {
249 mir_wait_for_one(mir_window_set_state(surf,249#pragma GCC diagnostic push
250 mir_window_state_maximized));250#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
251 mir_wait_for_one(mir_window_set_state(surf,251 mir_wait_for_one(mir_surface_set_state(surf,
252 mir_window_state_restored));252 mir_surface_state_maximized));
253 mir_wait_for_one(mir_window_set_state(surf,253 mir_wait_for_one(mir_surface_set_state(surf,
254 mir_window_state_fullscreen));254 mir_surface_state_restored));
255 mir_wait_for_one(mir_window_set_state(surf,255 mir_wait_for_one(mir_surface_set_state(surf,
256 mir_window_state_minimized));256 mir_surface_state_fullscreen));
257 mir_wait_for_one(mir_surface_set_state(surf,
258 mir_surface_state_minimized));
259#pragma GCC diagnostic pop
257 }260 }
258 }261 }
259};262};
@@ -405,24 +408,30 @@
405408
406 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_restored));409 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_restored));
407410
408 mir_wait_for(mir_window_set_state(window, mir_window_state_fullscreen));411#pragma GCC diagnostic push
409 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_fullscreen));412#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
410413 mir_wait_for(mir_surface_set_state(window, mir_surface_state_fullscreen));
411 mir_wait_for(mir_window_set_state(window, static_cast<MirWindowState>(999)));414 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_fullscreen));
412 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_fullscreen));415
413416 mir_wait_for(mir_surface_set_state(window, static_cast<MirSurfaceState>(999)));
414 mir_wait_for(mir_window_set_state(window, mir_window_state_horizmaximized));417 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_fullscreen));
415 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_horizmaximized));418
416419 mir_wait_for(mir_surface_set_state(window, mir_surface_state_horizmaximized));
417 mir_wait_for(mir_window_set_state(window, static_cast<MirWindowState>(888)));420 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_horizmaximized));
418 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_horizmaximized));421
422 mir_wait_for(mir_surface_set_state(window, static_cast<MirSurfaceState>(888)));
423 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_horizmaximized));
424#pragma GCC diagnostic pop
419425
420 // Stress-test synchronization logic with some flooding426 // Stress-test synchronization logic with some flooding
421 for (int i = 0; i < 100; i++)427 for (int i = 0; i < 100; i++)
422 {428 {
423 mir_window_set_state(window, mir_window_state_maximized);429 mir_window_set_state(window, mir_window_state_maximized);
424 mir_window_set_state(window, mir_window_state_restored);430 mir_window_set_state(window, mir_window_state_restored);
425 mir_wait_for(mir_window_set_state(window, mir_window_state_fullscreen));431#pragma GCC diagnostic push
432#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
433 mir_wait_for(mir_surface_set_state(window, mir_surface_state_fullscreen));
434#pragma GCC diagnostic pop
426 ASSERT_THAT(mir_window_get_state(window), Eq(mir_window_state_fullscreen));435 ASSERT_THAT(mir_window_get_state(window), Eq(mir_window_state_fullscreen));
427 }436 }
428437
429438
=== modified file 'tests/acceptance-tests/test_client_surface_events.cpp'
--- tests/acceptance-tests/test_client_surface_events.cpp 2017-01-11 20:17:22 +0000
+++ tests/acceptance-tests/test_client_surface_events.cpp 2017-01-13 22:52:30 +0000
@@ -196,9 +196,11 @@
196196
197TEST_F(ClientSurfaceEvents, surface_receives_state_events)197TEST_F(ClientSurfaceEvents, surface_receives_state_events)
198{198{
199#pragma GCC diagnostic push
200#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
199 {201 {
200 mir_wait_for(mir_window_set_state(window, mir_window_state_fullscreen));202 mir_wait_for(mir_surface_set_state(window, mir_surface_state_fullscreen));
201 mir_wait_for(mir_window_set_state(other_surface, mir_window_state_vertmaximized));203 mir_wait_for(mir_surface_set_state(other_surface, mir_surface_state_vertmaximized));
202204
203 std::lock_guard<decltype(last_event_mutex)> last_event_lock{last_event_mutex};205 std::lock_guard<decltype(last_event_mutex)> last_event_lock{last_event_mutex};
204206
@@ -206,7 +208,7 @@
206 }208 }
207209
208 {210 {
209 mir_wait_for(mir_window_set_state(window, static_cast<MirWindowState>(999)));211 mir_wait_for(mir_surface_set_state(window, static_cast<MirSurfaceState>(999)));
210212
211 std::lock_guard<decltype(last_event_mutex)> last_event_lock{last_event_mutex};213 std::lock_guard<decltype(last_event_mutex)> last_event_lock{last_event_mutex};
212 EXPECT_THAT(last_event, mt::WindowEvent(mir_window_attrib_state, mir_window_state_fullscreen));214 EXPECT_THAT(last_event, mt::WindowEvent(mir_window_attrib_state, mir_window_state_fullscreen));
@@ -215,7 +217,7 @@
215 reset_last_event();217 reset_last_event();
216218
217 {219 {
218 mir_wait_for(mir_window_set_state(window, mir_window_state_vertmaximized));220 mir_wait_for(mir_surface_set_state(window, mir_surface_state_vertmaximized));
219221
220 std::lock_guard<decltype(last_event_mutex)> last_event_lock{last_event_mutex};222 std::lock_guard<decltype(last_event_mutex)> last_event_lock{last_event_mutex};
221223
@@ -225,13 +227,14 @@
225 reset_last_event();227 reset_last_event();
226228
227 {229 {
228 mir_wait_for(mir_window_set_state(window, static_cast<MirWindowState>(777)));230 mir_wait_for(mir_surface_set_state(window, static_cast<MirSurfaceState>(777)));
229 mir_wait_for(mir_window_set_state(other_surface, mir_window_state_maximized));231 mir_wait_for(mir_surface_set_state(other_surface, mir_surface_state_maximized));
230232
231 std::lock_guard<decltype(last_event_mutex)> last_event_lock{last_event_mutex};233 std::lock_guard<decltype(last_event_mutex)> last_event_lock{last_event_mutex};
232234
233 EXPECT_EQ(nullptr, last_event);235 EXPECT_EQ(nullptr, last_event);
234 }236 }
237#pragma GCC diagnostic pop
235}238}
236239
237struct OrientationEvents : ClientSurfaceEvents, ::testing::WithParamInterface<MirOrientation> {};240struct OrientationEvents : ClientSurfaceEvents, ::testing::WithParamInterface<MirOrientation> {};
@@ -274,6 +277,7 @@
274 }277 }
275}278}
276279
280
277TEST_F(ClientSurfaceEvents, surface_receives_close_event)281TEST_F(ClientSurfaceEvents, surface_receives_close_event)
278{282{
279 set_event_filter(mir_event_type_close_window);283 set_event_filter(mir_event_type_close_window);
280284
=== modified file 'tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp'
--- tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 2017-01-12 16:45:44 +0000
+++ tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 2017-01-13 22:52:30 +0000
@@ -87,8 +87,10 @@
87{87{
88 EXPECT_CALL(*mock_window_manager,88 EXPECT_CALL(*mock_window_manager,
89 set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized)));89 set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized)));
9090#pragma GCC diagnostic push
91 mir_wait_for(mir_window_set_state(window, mir_window_state_maximized));91#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
92 mir_wait_for(mir_surface_set_state(window, mir_surface_state_maximized));
93#pragma GCC diagnostic pop
9294
93 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_maximized));95 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_maximized));
94}96}
@@ -108,8 +110,10 @@
108 EXPECT_CALL(*mock_window_manager,110 EXPECT_CALL(*mock_window_manager,
109 set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized)))111 set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized)))
110 .WillOnce(Invoke(set_to_vertmax));112 .WillOnce(Invoke(set_to_vertmax));
111113#pragma GCC diagnostic push
112 mir_wait_for(mir_window_set_state(window, mir_window_state_maximized));114#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
115 mir_wait_for(mir_surface_set_state(window, mir_surface_state_maximized));
116#pragma GCC diagnostic pop
113117
114 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_vertmaximized));118 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_vertmaximized));
115}119}
116120
=== modified file 'tests/acceptance-tests/test_surface_modifications.cpp'
--- tests/acceptance-tests/test_surface_modifications.cpp 2017-01-10 23:55:25 +0000
+++ tests/acceptance-tests/test_surface_modifications.cpp 2017-01-13 22:52:30 +0000
@@ -572,8 +572,11 @@
572 EXPECT_CALL(surface_observer, hidden_set_to(is_visible(initial_state)));572 EXPECT_CALL(surface_observer, hidden_set_to(is_visible(initial_state)));
573 EXPECT_CALL(surface_observer, hidden_set_to(is_visible(new_state)));573 EXPECT_CALL(surface_observer, hidden_set_to(is_visible(new_state)));
574574
575 mir_wait_for(mir_window_set_state(window, initial_state));575#pragma GCC diagnostic push
576 mir_wait_for(mir_window_set_state(window, new_state));576#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
577 mir_wait_for(mir_surface_set_state(window, static_cast<MirSurfaceState>(initial_state)));
578 mir_wait_for(mir_surface_set_state(window, static_cast<MirSurfaceState>(new_state)));
579#pragma GCC diagnostic pop
577}580}
578581
579INSTANTIATE_TEST_CASE_P(SurfaceModifications, SurfaceStateCase,582INSTANTIATE_TEST_CASE_P(SurfaceModifications, SurfaceStateCase,

Subscribers

People subscribed via source and target branches