Mir

Merge lp:~raof/mir/fix-and-enable-lto into lp:mir

Proposed by Chris Halse Rogers
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 3353
Proposed branch: lp:~raof/mir/fix-and-enable-lto
Merge into: lp:mir
Diff against target: 593 lines (+144/-59)
30 files modified
CMakeLists.txt (+7/-0)
benchmarks/frame-uniformity/CMakeLists.txt (+6/-0)
cmake/FindGtestGmock.cmake (+1/-1)
cmake/MirCommon.cmake (+42/-9)
debian/rules (+7/-1)
examples/CMakeLists.txt (+0/-2)
examples/animated_cursor_demo_client.c (+0/-2)
src/client/buffer_stream.cpp (+1/-1)
src/client/buffer_stream.h (+1/-1)
src/client/client_buffer_stream.h (+25/-2)
src/client/lttng/CMakeLists.txt (+5/-0)
src/client/screencast_stream.cpp (+1/-1)
src/client/screencast_stream.h (+1/-1)
src/common/sharedlibrary/module_deleter.cpp (+0/-3)
src/common/thread/thread_name.cpp (+0/-3)
src/include/client/mir/client_platform.h (+3/-1)
src/platforms/android/client/android_client_platform.cpp (+3/-6)
src/platforms/android/client/android_client_platform.h (+1/-1)
src/platforms/common/client/mir/aging_buffer.h (+3/-3)
src/platforms/mesa/client/client_platform.cpp (+3/-6)
src/platforms/mesa/client/client_platform.h (+1/-1)
src/server/report/lttng/CMakeLists.txt (+5/-0)
tests/acceptance-tests/throwback/test_client_library_errors.cpp (+1/-1)
tests/include/mir_test_framework/client_platform_factory.h (+20/-2)
tests/include/mir_test_framework/stub_client_platform_factory.h (+1/-1)
tests/mir_test/current_thread_name.cpp (+0/-3)
tests/mir_test_framework/stub_client_platform_factory.cpp (+2/-3)
tests/unit-tests/client/test_client_buffer_stream.cpp (+2/-2)
tests/unit-tests/client/test_client_platform.cpp (+1/-1)
tests/unit-tests/client/test_mir_connection.cpp (+1/-1)
To merge this branch: bzr merge lp:~raof/mir/fix-and-enable-lto
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Alan Griffiths Approve
Cemil Azizoglu (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Andreas Pokorny (community) Approve
Review via email: mp+282133@code.launchpad.net

This proposal supersedes a proposal from 2015-12-22.

Commit message

Fix LTO build, and enable it for Debian packages.

Fixes: https://bugs.launchpad.net/mir/+bug/1350343

Description of the change

Fix LTO build, and enable it for Debian packages.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal

/usr/include/i386-linux-gnu/bits/stat.h:46:8: error: type 'struct stat' violates one definition rule [-Werror=odr]
 struct stat
        ^
/usr/include/i386-linux-gnu/bits/stat.h:46:0: note: a different type is defined in another translation unit
 struct stat
 ^
/usr/include/i386-linux-gnu/bits/stat.h:53:13: note: the first difference of corresponding definitions is field 'st_ino'
     __ino_t st_ino; /* File serial number. */
             ^
/usr/include/i386-linux-gnu/bits/stat.h:55:13: note: a field with different name is defined in another translation unit
     __ino_t __st_ino; /* 32bit file serial number. */

Interesting... this seems to be a genuine error; we've included stat.h with twice, with different compile options, really giving us two different definitions of struct stat.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

hmm will gcc-nm and gcc-ar work for cross compilation?

review: Needs Information
Revision history for this message
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal

That's a fair question. Looks like it works, which somewhat surprised me :).

Of course, this also means that a cross-compile doesn't hit the issue that hit mediumtests-builder-vivid-armhf. Of course.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

ah the job of nm and ar is more elf-ish, tar-ish and less-ish so they might not need to interfere with the actual target format

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

Not sure why LP has this a "Merged" - it clearly isn't.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:3236
https://mir-jenkins.ubuntu.com/job/mir-ci/15/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/15/console

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

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3238
https://mir-jenkins.ubuntu.com/job/mir-ci/23/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/23/console

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

review: Approve (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

https://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-touch/7917/consoleFull says

[1452488342.218071] mirserver: Selected driver: android (version 0.19.0)
ERROR: Dynamic exception type: St12system_error
std::exception::what: Enable multithreading to use std::thread: Operation not permitted

Do we need to clutter cmake with more pthread flags?

Apart from that. I can live with that fancy solution.

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

Apart from the android failure looks good.

Should we also force use of gold with LTO?

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

There is now a conflict, when resolved there is a chance that the problem on vivid/armhf is gone.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3341
https://mir-jenkins.ubuntu.com/job/mir-ci/398/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/194
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/211
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/207
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/207
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/199
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/199/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/199
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/199/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/199
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/199/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/199
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/199/artifact/output/*zip*/output.zip

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

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

+static_assert(
+ std::is_pointer<EGLNativeWindowType>::value ||
+ sizeof(EGLNativeWindowType) == sizeof(void*),
+ "Oh, oh. EGLNativeWindowType isn't losslessly convertible to void*.\n"
+ "The ClientBufferStream requires that EGLNativeWindowType be convertible to void*");

It seems odd that this is needed for the LTO MP and that it is needed in two headers (out of the five that #include <EGL/eglplatform.h>).

What's the reasoning for this approach and should we have a single wrapper header for all uses?

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

Moved the static_assert() check to a more relevant header, and gave it a more explicit comment.

It's here because the LTO turned out to allow a check which found that we were returning different types from different virtual overrides, because EGLNativeWindowType is a different type on different EGL platforms.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3348
https://mir-jenkins.ubuntu.com/job/mir-ci/405/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/205/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/229
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/221
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/221
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/211/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/211
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/211/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/211/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/211/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/211
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/211/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

Ah, there it is.

Different layouts for BufferStream because EGLNativeWindowType differs...

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3349
https://mir-jenkins.ubuntu.com/job/mir-ci/408/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/208/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/232
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/224
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/224
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/214/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/214
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/214/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/214
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/214/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/214
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/214/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/214
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/214/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

I'm going to disable LTO on the clang build; it's too difficult to debug with clang being all not working in recent releases.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3349
https://mir-jenkins.ubuntu.com/job/mir-ci/409/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/209
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/233
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/225
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/225
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/216
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/216/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/216
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/216/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/216
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/216/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/216
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/216/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/216
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/216/artifact/output/*zip*/output.zip

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

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

+ -DMIR_LINK_TIME_OPTIMIZATION=ON

While this is probably right, we ought to be explicit about which builds we want this optimization for (as it can slow things quite a bit).

I'd suggest not for the "normal" CI and developer builds where fast turnaround is desirable.

I think problems will be rare enough that enabling for autolanding would be fine as a final check. And for release.

Is that what happens?

(It also suggests the question of any compile-time optimizations we might want to enable.)

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

> I think problems will be rare enough that enabling for autolanding would be
> fine as a final check. And for release.

+1

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

Ok. I've gated MIR_LINK_TIME_OPTIMIZATION on the presence or absence of “noopt” in the DEB_BUILD_OPTIONS environment variable. This is a standard interface for Debian package builds.

I've also started to hook this up to CI, so that we pass DEB_BUILD_OPTIONS=noopt for normal builds (so we'll get slightly faster -O0 builds for normal CI) and not pass it for autolanding.

Sadly CI is currently broken, having run out of disc space, and I don't think I have the ability to fix it without a shell on that machine.

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

LGTM

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3350
https://mir-jenkins.ubuntu.com/job/mir-ci/432/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/242/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/266
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/258
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/258
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/249
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/249/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/249
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/249/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/249
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/249/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/249
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/249/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/249/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/249/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3350
https://mir-jenkins.ubuntu.com/job/mir-ci/452/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/268
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/292
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/284
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/284
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/276/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/276/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/276/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/276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/276/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/276/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-02-25 17:58:32 +0000
3+++ CMakeLists.txt 2016-02-28 23:45:57 +0000
4@@ -34,6 +34,8 @@
5 add_definitions(-DMIR_VERSION_MAJOR=${MIR_VERSION_MAJOR})
6 add_definitions(-DMIR_VERSION_MINOR=${MIR_VERSION_MINOR})
7 add_definitions(-DMIR_VERSION_MICRO=${MIR_VERSION_PATCH})
8+add_definitions(-D_GNU_SOURCE)
9+add_definitions(-D_FILE_OFFSET_BITS=64)
10
11 set(MIR_VERSION ${MIR_VERSION_MAJOR}.${MIR_VERSION_MINOR}.${MIR_VERSION_PATCH})
12
13@@ -81,6 +83,11 @@
14 if(MIR_LINK_TIME_OPTIMIZATION)
15 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
16 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
17+ if(${CMAKE_COMPILER_IS_GNUCXX})
18+ set(CMAKE_NM "gcc-nm")
19+ set(CMAKE_AR "gcc-ar")
20+ set(CMAKE_RANLIB "gcc-ranlib")
21+ endif()
22 endif()
23
24 string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower)
25
26=== modified file 'benchmarks/frame-uniformity/CMakeLists.txt'
27--- benchmarks/frame-uniformity/CMakeLists.txt 2016-01-29 08:18:22 +0000
28+++ benchmarks/frame-uniformity/CMakeLists.txt 2016-02-28 23:45:57 +0000
29@@ -15,6 +15,12 @@
30 ${PROJECT_SOURCE_DIR}/tests/include/
31 )
32
33+# We use mir-test-{doubles,framework}, which builds differently based on
34+# the primary test platform.
35+if (MIR_TEST_PLATFORM STREQUAL "android")
36+ add_definitions(-DANDROID)
37+endif()
38+
39 mir_add_wrapped_executable(frame_uniformity_test_client NOINSTALL
40 touch_measuring_client.cpp
41 touch_producing_server.cpp
42
43=== modified file 'cmake/FindGtestGmock.cmake'
44--- cmake/FindGtestGmock.cmake 2016-01-29 08:18:22 +0000
45+++ cmake/FindGtestGmock.cmake 2016-02-28 23:45:57 +0000
46@@ -20,7 +20,7 @@
47 set(GMOCK_BINARY_DIR ${CMAKE_BINARY_DIR}/${GMOCK_PREFIX}/libs)
48 set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest)
49
50-set(GTEST_CXX_FLAGS "-fPIC")
51+set(GTEST_CXX_FLAGS "-fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64")
52 if (cmake_build_type_lower MATCHES "threadsanitizer")
53 set(GTEST_CXX_FLAGS "${GTEST_CXX_FLAGS} -fsanitize=thread")
54 elseif (cmake_build_type_lower MATCHES "ubsanitizer")
55
56=== modified file 'cmake/MirCommon.cmake'
57--- cmake/MirCommon.cmake 2016-02-22 03:59:29 +0000
58+++ cmake/MirCommon.cmake 2016-02-28 23:45:57 +0000
59@@ -150,11 +150,15 @@
60 endif()
61 endfunction()
62
63-
64 function (mir_precompiled_header TARGET HEADER)
65 if (MIR_USE_PRECOMPILED_HEADERS)
66- get_property(TARGET_COMPILE_FLAGS TARGET ${TARGET} PROPERTY COMPILE_FLAGS)
67+ get_filename_component(HEADER_NAME ${HEADER} NAME)
68+
69 get_property(TARGET_INCLUDE_DIRECTORIES TARGET ${TARGET} PROPERTY INCLUDE_DIRECTORIES)
70+
71+ set(TARGET_COMPILE_DEFINITIONS "$<TARGET_PROPERTY:${TARGET},COMPILE_DEFINITIONS>")
72+ set(TARGET_COMPILE_DEFINITIONS "$<$<BOOL:${TARGET_COMPILE_DEFINITIONS}>:-D$<JOIN:${TARGET_COMPILE_DEFINITIONS},\n-D>\n>")
73+
74 foreach(dir ${TARGET_INCLUDE_DIRECTORIES})
75 if (${dir} MATCHES "usr/include")
76 set(TARGET_INCLUDE_DIRECTORIES_STRING "${TARGET_INCLUDE_DIRECTORIES_STRING} -isystem ${dir}")
77@@ -174,15 +178,44 @@
78 #
79 # I'm unaware of a less roundabout method of getting the *actual* build flags for a target.
80 string(TOUPPER "${CMAKE_BUILD_TYPE}" UC_BUILD_TYPE)
81- separate_arguments(
82- PCH_CXX_FLAGS UNIX_COMMAND
83- "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UC_BUILD_TYPE}} ${TARGET_COMPILE_FLAGS} ${TARGET_INCLUDE_DIRECTORIES_STRING}"
84- )
85-
86+
87+ # Lllloook at you, haaacker. A pa-pa-pathetic creature of meat and bone.
88+ #
89+ # It appears that we can *only* get the COMPILE_DEFINITIONS as a generator expression.
90+ # This wouldn't be so bad if http://www.kwwidgets.org/Bug/view.php?id=14353#c33712 didn't mean
91+ # that you can't use generator expressions in custom commands.
92+ #
93+ # So!
94+ # What we *can* do is generate a file with the contents of the generator expressions,
95+ # then use gcc's @file mechanism...
96+ set(FLAGS_FILE "${CMAKE_CURRENT_BINARY_DIR}/${HEADER_NAME}.compileflags")
97+
98+ file(
99+ GENERATE
100+ OUTPUT "${FLAGS_FILE}"
101+ CONTENT "
102+ ${CMAKE_CXX_FLAGS}
103+ ${CMAKE_CXX_FLAGS_${UC_BUILD_TYPE}}
104+ ${TARGET_INCLUDE_DIRECTORIES_STRING}
105+ ${TARGET_COMPILE_DEFINITIONS}"
106+ )
107+
108+ # HA HA!
109+ #
110+ # Of course, that has unescaped all the escaped \"s we have in the compile definitions.
111+ # gcc treats the contents of @file exactly as if it came from the command line, so we need to
112+ # re-escape them.
113+ add_custom_command(
114+ OUTPUT ${FLAGS_FILE}.processed
115+ DEPENDS ${FLAGS_FILE}
116+ # ESCAPE ALL THE THINGS!
117+ COMMAND sh -c "sed s_\\\"_\\\\\\\\\\\"_g ${FLAGS_FILE} > ${FLAGS_FILE}.processed"
118+ VERBATIM
119+ )
120 add_custom_command(
121 OUTPUT ${TARGET}_precompiled.hpp.gch
122- DEPENDS ${HEADER}
123- COMMAND ${CMAKE_CXX_COMPILER} ${PCH_CXX_FLAGS} -x c++-header -c ${HEADER} -o ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_precompiled.hpp.gch
124+ DEPENDS ${HEADER} ${FLAGS_FILE}.processed
125+ COMMAND ${CMAKE_CXX_COMPILER} @${FLAGS_FILE}.processed -x c++-header -c ${HEADER} -o ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_precompiled.hpp.gch
126 )
127
128 set_property(TARGET ${TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS " -include ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_precompiled.hpp -Winvalid-pch ")
129
130=== modified file 'debian/rules'
131--- debian/rules 2016-02-23 05:12:14 +0000
132+++ debian/rules 2016-02-28 23:45:57 +0000
133@@ -20,7 +20,13 @@
134 endif
135
136 COMMON_CONFIGURE_OPTIONS = \
137- -DCMAKE_INSTALL_LIBEXECDIR="lib/$(DEB_HOST_MULTIARCH)/mir"
138+ -DCMAKE_INSTALL_LIBEXECDIR="lib/$(DEB_HOST_MULTIARCH)/mir"\
139+
140+ifeq ($(filter noopt,$(DEB_BUILD_OPTIONS)),noopt)
141+ COMMON_CONFIGURE_OPTIONS += -DMIR_LINK_TIME_OPTIMIZATION=OFF
142+else
143+ COMMON_CONFIGURE_OPTIONS += -DMIR_LINK_TIME_OPTIMIZATION=ON
144+endif
145
146 override_dh_auto_configure:
147 ifeq ($(DEB_HOST_ARCH),armhf)
148
149=== modified file 'examples/CMakeLists.txt'
150--- examples/CMakeLists.txt 2016-02-26 02:31:41 +0000
151+++ examples/CMakeLists.txt 2016-02-28 23:45:57 +0000
152@@ -41,8 +41,6 @@
153 xcursor.h
154 )
155
156-SET_SOURCE_FILES_PROPERTIES(xcursor.c PROPERTIES COMPILE_FLAGS -D_GNU_SOURCE)
157-
158 target_link_libraries(eglapp
159 mirclient
160 ${EGL_LIBRARIES}
161
162=== modified file 'examples/animated_cursor_demo_client.c'
163--- examples/animated_cursor_demo_client.c 2016-02-22 03:59:29 +0000
164+++ examples/animated_cursor_demo_client.c 2016-02-28 23:45:57 +0000
165@@ -16,8 +16,6 @@
166 * Author: Robert Carr <robert.carr@canonical.com>
167 */
168
169-#define _GNU_SOURCE
170-
171 #include "eglapp.h"
172
173 #include "mir_toolkit/mir_client_library.h"
174
175=== modified file 'src/client/buffer_stream.cpp'
176--- src/client/buffer_stream.cpp 2016-02-10 06:31:19 +0000
177+++ src/client/buffer_stream.cpp 2016-02-28 23:45:57 +0000
178@@ -572,7 +572,7 @@
179 EGLNativeWindowType mcl::BufferStream::egl_native_window()
180 {
181 std::unique_lock<decltype(mutex)> lock(mutex);
182- return *egl_native_window_;
183+ return static_cast<EGLNativeWindowType>(egl_native_window_.get());
184 }
185
186 void mcl::BufferStream::release_cpu_region()
187
188=== modified file 'src/client/buffer_stream.h'
189--- src/client/buffer_stream.h 2016-02-10 06:31:19 +0000
190+++ src/client/buffer_stream.h 2016-02-28 23:45:57 +0000
191@@ -147,7 +147,7 @@
192 float scale_;
193
194 std::shared_ptr<mir::client::PerfReport> const perf_report;
195- std::shared_ptr<EGLNativeWindowType> egl_native_window_;
196+ std::shared_ptr<void> egl_native_window_;
197
198 MirWaitHandle interval_wait_handle;
199 std::unique_ptr<mir::protobuf::Void> protobuf_void;
200
201=== modified file 'src/client/client_buffer_stream.h'
202--- src/client/client_buffer_stream.h 2016-02-22 03:59:29 +0000
203+++ src/client/client_buffer_stream.h 2016-02-28 23:45:57 +0000
204@@ -27,10 +27,33 @@
205 #include "mir_toolkit/mir_native_buffer.h"
206 #include "mir_wait_handle.h"
207
208-#include <EGL/eglplatform.h>
209-
210 #include <memory>
211 #include <functional>
212+#include <EGL/eglplatform.h>
213+
214+/*
215+ * ClientBufferStream::egl_native_window() returns EGLNativeWindowType.
216+ *
217+ * EGLNativeWindowType is an EGL platform-specific type that is typically a
218+ * (possibly slightly obfuscated) pointer. This makes our client module ABI
219+ * technically EGL-platform dependent, which is awkward because we support
220+ * multiple EGL platforms.
221+ *
222+ * On both the Mesa and the Android EGL platforms EGLNativeWindow is a
223+ * pointer or a uintptr_t.
224+ *
225+ * In practise EGLNativeWindowType is always a typedef to a pointer-ish, but
226+ * for paranoia's sake make sure the build will fail if we ever encounter a
227+ * strange EGL platform where this isn't the case.
228+ */
229+#include <type_traits>
230+static_assert(
231+ sizeof(EGLNativeWindowType) == sizeof(void*) &&
232+ std::is_pod<EGLNativeWindowType>::value,
233+ "The ClientBufferStream requires that EGLNativeWindowType be no-op convertible to void*");
234+
235+#undef EGLNativeWindowType
236+#define EGLNativeWindowType void*
237
238 namespace mir
239 {
240
241=== modified file 'src/client/lttng/CMakeLists.txt'
242--- src/client/lttng/CMakeLists.txt 2015-06-17 05:20:42 +0000
243+++ src/client/lttng/CMakeLists.txt 2016-02-28 23:45:57 +0000
244@@ -10,6 +10,11 @@
245 perf_report.cpp
246 )
247
248+# Using LTO on the lttng DSO causes a gcc ICE.
249+# Since LTO is reasonably uninteresting for the lttng tracer, disable it.
250+string(REPLACE "-flto" "" NO_LTO_FLAGS ${CMAKE_C_FLAGS})
251+set(CMAKE_C_FLAGS ${NO_LTO_FLAGS})
252+
253 add_library(mirclientlttng SHARED tracepoints.c)
254
255 # Don't treat missing-field-initializers as an error, since
256
257=== modified file 'src/client/screencast_stream.cpp'
258--- src/client/screencast_stream.cpp 2016-01-28 19:05:20 +0000
259+++ src/client/screencast_stream.cpp 2016-02-28 23:45:57 +0000
260@@ -148,7 +148,7 @@
261
262 EGLNativeWindowType mcl::ScreencastStream::egl_native_window()
263 {
264- return *egl_native_window_;
265+ return static_cast<EGLNativeWindowType>(egl_native_window_.get());
266 }
267
268 std::shared_ptr<mcl::MemoryRegion> mcl::ScreencastStream::secure_for_cpu_write()
269
270=== modified file 'src/client/screencast_stream.h'
271--- src/client/screencast_stream.h 2016-01-28 17:26:23 +0000
272+++ src/client/screencast_stream.h 2016-02-28 23:45:57 +0000
273@@ -113,7 +113,7 @@
274 std::unique_ptr<mir::protobuf::BufferStream> protobuf_bs;
275 int const swap_interval_{1};
276
277- std::shared_ptr<EGLNativeWindowType> egl_native_window_;
278+ std::shared_ptr<void> egl_native_window_;
279
280 MirWaitHandle create_wait_handle;
281 MirWaitHandle release_wait_handle;
282
283=== modified file 'src/common/sharedlibrary/module_deleter.cpp'
284--- src/common/sharedlibrary/module_deleter.cpp 2016-01-29 08:18:22 +0000
285+++ src/common/sharedlibrary/module_deleter.cpp 2016-02-28 23:45:57 +0000
286@@ -20,9 +20,6 @@
287
288 #include "mir/shared_library.h"
289
290-#ifndef _GNU_SOURCE
291-#define _GNU_SOURCE
292-#endif
293 #include <dlfcn.h>
294 #include <atomic>
295
296
297=== modified file 'src/common/thread/thread_name.cpp'
298--- src/common/thread/thread_name.cpp 2015-02-22 07:46:25 +0000
299+++ src/common/thread/thread_name.cpp 2016-02-28 23:45:57 +0000
300@@ -18,9 +18,6 @@
301
302 #include "mir/thread_name.h"
303
304-#ifndef _GNU_SOURCE
305-#define _GNU_SOURCE
306-#endif
307 #include <pthread.h>
308
309 void mir::set_thread_name(std::string const& name)
310
311=== modified file 'src/include/client/mir/client_platform.h'
312--- src/include/client/mir/client_platform.h 2016-01-29 08:18:22 +0000
313+++ src/include/client/mir/client_platform.h 2016-02-28 23:45:57 +0000
314@@ -61,7 +61,9 @@
315 */
316 virtual MirPlatformMessage* platform_operation(MirPlatformMessage const* request) = 0;
317 virtual std::shared_ptr<ClientBufferFactory> create_buffer_factory() = 0;
318- virtual std::shared_ptr<EGLNativeWindowType> create_egl_native_window(EGLNativeSurface *surface) = 0;
319+ // EGLNativeWindowType differs between platforms, so can't reasonably be used in the
320+ // platform-independent interface.
321+ virtual std::shared_ptr<void> create_egl_native_window(EGLNativeSurface *surface) = 0;
322 virtual std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() = 0;
323 virtual MirNativeBuffer* convert_native_buffer(graphics::NativeBuffer*) const = 0;
324 virtual MirPixelFormat get_egl_pixel_format(EGLDisplay, EGLConfig) const = 0;
325
326=== modified file 'src/platforms/android/client/android_client_platform.cpp'
327--- src/platforms/android/client/android_client_platform.cpp 2016-01-29 08:18:22 +0000
328+++ src/platforms/android/client/android_client_platform.cpp 2016-02-28 23:45:57 +0000
329@@ -75,9 +75,8 @@
330 MirNativeWindowDeleter(mga::MirNativeWindow* window)
331 : window(window) {}
332
333- void operator()(EGLNativeWindowType* type)
334+ void operator()(void*)
335 {
336- delete type;
337 delete window;
338 }
339
340@@ -86,14 +85,12 @@
341 };
342 }
343
344-std::shared_ptr<EGLNativeWindowType> mcla::AndroidClientPlatform::create_egl_native_window(EGLNativeSurface *surface)
345+std::shared_ptr<void> mcla::AndroidClientPlatform::create_egl_native_window(EGLNativeSurface *surface)
346 {
347 auto anativewindow_interpreter = std::make_shared<mcla::EGLNativeSurfaceInterpreter>(*surface);
348 auto mir_native_window = new mga::MirNativeWindow(anativewindow_interpreter);
349- auto egl_native_window = new EGLNativeWindowType;
350- *egl_native_window = mir_native_window;
351 MirNativeWindowDeleter deleter = MirNativeWindowDeleter(mir_native_window);
352- return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter);
353+ return std::shared_ptr<void>(mir_native_window, deleter);
354 }
355
356 std::shared_ptr<EGLNativeDisplayType>
357
358=== modified file 'src/platforms/android/client/android_client_platform.h'
359--- src/platforms/android/client/android_client_platform.h 2016-01-29 08:18:22 +0000
360+++ src/platforms/android/client/android_client_platform.h 2016-02-28 23:45:57 +0000
361@@ -37,7 +37,7 @@
362 void populate(MirPlatformPackage& package) const override;
363 MirPlatformMessage* platform_operation(MirPlatformMessage const* request) override;
364 std::shared_ptr<ClientBufferFactory> create_buffer_factory() override;
365- std::shared_ptr<EGLNativeWindowType> create_egl_native_window(EGLNativeSurface *surface) override;
366+ std::shared_ptr<void> create_egl_native_window(EGLNativeSurface *surface) override;
367 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() override;
368 MirNativeBuffer* convert_native_buffer(graphics::NativeBuffer*) const override;
369 MirPixelFormat get_egl_pixel_format(EGLDisplay, EGLConfig) const override;
370
371=== modified file 'src/platforms/common/client/mir/aging_buffer.h'
372--- src/platforms/common/client/mir/aging_buffer.h 2015-02-22 07:46:25 +0000
373+++ src/platforms/common/client/mir/aging_buffer.h 2016-02-28 23:45:57 +0000
374@@ -31,9 +31,9 @@
375 public:
376 AgingBuffer();
377
378- virtual uint32_t age() const;
379- virtual void increment_age();
380- virtual void mark_as_submitted();
381+ uint32_t age() const override;
382+ void increment_age() override;
383+ void mark_as_submitted() override;
384
385 private:
386 uint32_t buffer_age;
387
388=== modified file 'src/platforms/mesa/client/client_platform.cpp'
389--- src/platforms/mesa/client/client_platform.cpp 2016-01-29 08:18:22 +0000
390+++ src/platforms/mesa/client/client_platform.cpp 2016-02-28 23:45:57 +0000
391@@ -80,9 +80,8 @@
392 NativeWindowDeleter(mclm::NativeSurface* window)
393 : window(window) {}
394
395- void operator()(EGLNativeWindowType* type)
396+ void operator()(void*)
397 {
398- delete type;
399 delete window;
400 }
401
402@@ -91,14 +90,12 @@
403 };
404 }
405
406-std::shared_ptr<EGLNativeWindowType> mclm::ClientPlatform::create_egl_native_window(EGLNativeSurface* client_surface)
407+std::shared_ptr<void> mclm::ClientPlatform::create_egl_native_window(EGLNativeSurface* client_surface)
408 {
409 //TODO: this is awkward on both android and gbm...
410 auto native_window = new NativeSurface(*client_surface);
411- auto egl_native_window = new EGLNativeWindowType;
412- *egl_native_window = reinterpret_cast<EGLNativeWindowType>(native_window);
413 NativeWindowDeleter deleter(native_window);
414- return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter);
415+ return std::shared_ptr<void>(native_window, deleter);
416 }
417
418 std::shared_ptr<EGLNativeDisplayType> mclm::ClientPlatform::create_egl_native_display()
419
420=== modified file 'src/platforms/mesa/client/client_platform.h'
421--- src/platforms/mesa/client/client_platform.h 2016-01-29 08:18:22 +0000
422+++ src/platforms/mesa/client/client_platform.h 2016-02-28 23:45:57 +0000
423@@ -45,7 +45,7 @@
424 void populate(MirPlatformPackage& package) const override;
425 MirPlatformMessage* platform_operation(MirPlatformMessage const* request) override;
426 std::shared_ptr<ClientBufferFactory> create_buffer_factory() override;
427- std::shared_ptr<EGLNativeWindowType> create_egl_native_window(EGLNativeSurface *surface) override;
428+ std::shared_ptr<void> create_egl_native_window(EGLNativeSurface *surface) override;
429 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() override;
430 MirNativeBuffer* convert_native_buffer(graphics::NativeBuffer*) const override;
431 MirPixelFormat get_egl_pixel_format(EGLDisplay, EGLConfig) const override;
432
433=== modified file 'src/server/report/lttng/CMakeLists.txt'
434--- src/server/report/lttng/CMakeLists.txt 2015-04-28 07:54:10 +0000
435+++ src/server/report/lttng/CMakeLists.txt 2016-02-28 23:45:57 +0000
436@@ -5,6 +5,11 @@
437 # harmless; it concerns a padding field)
438 add_compile_options(-Wno-error=missing-field-initializers -Wno-error=unused-function)
439
440+# Using LTO on the lttng DSO causes a gcc ICE.
441+# Since LTO is reasonably uninteresting for the lttng tracer, disable it.
442+string(REPLACE "-flto" "" NO_LTO_FLAGS ${CMAKE_C_FLAGS})
443+set(CMAKE_C_FLAGS ${NO_LTO_FLAGS})
444+
445 set(
446 LTTNG_SOURCES
447
448
449=== modified file 'tests/acceptance-tests/throwback/test_client_library_errors.cpp'
450--- tests/acceptance-tests/throwback/test_client_library_errors.cpp 2016-01-29 08:18:22 +0000
451+++ tests/acceptance-tests/throwback/test_client_library_errors.cpp 2016-02-28 23:45:57 +0000
452@@ -65,7 +65,7 @@
453 template<Method failure_set>
454 class ConfigurableFailurePlatform : public mir::client::ClientPlatform
455 {
456- std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mir::client::EGLNativeSurface *)
457+ std::shared_ptr<void> create_egl_native_window(mir::client::EGLNativeSurface *)
458 {
459 if (should_fail<Method::create_egl_native_window, failure_set>())
460 {
461
462=== modified file 'tests/include/mir_test_framework/client_platform_factory.h'
463--- tests/include/mir_test_framework/client_platform_factory.h 2016-01-29 08:18:22 +0000
464+++ tests/include/mir_test_framework/client_platform_factory.h 2016-02-28 23:45:57 +0000
465@@ -31,6 +31,22 @@
466 {
467 std::shared_ptr<mir::SharedLibrary> platform_library;
468
469+namespace
470+{
471+std::shared_ptr<mir::client::ClientPlatform> wrap_in_platform_library_cleanup(
472+ std::shared_ptr<mir::client::ClientPlatform>&& platform)
473+{
474+ return std::shared_ptr<mir::client::ClientPlatform>{
475+ platform.get(),
476+ [platform](mir::client::ClientPlatform*) mutable
477+ {
478+ platform.reset();
479+ platform_library.reset();
480+ }
481+ };
482+}
483+}
484+
485 std::shared_ptr<mir::client::ClientPlatform> create_android_client_platform()
486 {
487 using namespace testing;
488@@ -39,7 +55,8 @@
489 .WillByDefault(Invoke([](MirPlatformPackage& package) { ::memset(&package, 0, sizeof(package)); }));
490 platform_library = std::make_shared<mir::SharedLibrary>(client_platform("android"));
491 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");
492- return platform_factory(&ctx);
493+
494+ return wrap_in_platform_library_cleanup(platform_factory(&ctx));
495 }
496
497 std::shared_ptr<mir::client::ClientPlatform> create_mesa_client_platform(
498@@ -48,7 +65,8 @@
499 using namespace testing;
500 platform_library = std::make_shared<mir::SharedLibrary>(client_platform("mesa"));
501 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");
502- return platform_factory(client_context);
503+
504+ return wrap_in_platform_library_cleanup(platform_factory(client_context));
505 }
506
507 std::shared_ptr<mir::SharedLibrary>
508
509=== modified file 'tests/include/mir_test_framework/stub_client_platform_factory.h'
510--- tests/include/mir_test_framework/stub_client_platform_factory.h 2016-01-20 23:58:36 +0000
511+++ tests/include/mir_test_framework/stub_client_platform_factory.h 2016-02-28 23:45:57 +0000
512@@ -32,7 +32,7 @@
513 void populate(MirPlatformPackage& package) const;
514 MirPlatformMessage* platform_operation(MirPlatformMessage const*) override;
515 std::shared_ptr<mir::client::ClientBufferFactory> create_buffer_factory();
516- std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mir::client::EGLNativeSurface* surface);
517+ std::shared_ptr<void> create_egl_native_window(mir::client::EGLNativeSurface* surface);
518 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();
519 MirNativeBuffer* convert_native_buffer(mir::graphics::NativeBuffer* buf) const;
520 MirPixelFormat get_egl_pixel_format(EGLDisplay, EGLConfig) const override;
521
522=== modified file 'tests/mir_test/current_thread_name.cpp'
523--- tests/mir_test/current_thread_name.cpp 2015-06-25 03:00:08 +0000
524+++ tests/mir_test/current_thread_name.cpp 2016-02-28 23:45:57 +0000
525@@ -18,9 +18,6 @@
526
527 #include "mir/test/current_thread_name.h"
528
529-#ifndef _GNU_SOURCE
530-#define _GNU_SOURCE
531-#endif
532 #include <pthread.h>
533
534 std::string mir::test::current_thread_name()
535
536=== modified file 'tests/mir_test_framework/stub_client_platform_factory.cpp'
537--- tests/mir_test_framework/stub_client_platform_factory.cpp 2016-01-29 08:18:22 +0000
538+++ tests/mir_test_framework/stub_client_platform_factory.cpp 2016-02-28 23:45:57 +0000
539@@ -55,10 +55,9 @@
540 return std::make_shared<mtd::StubClientBufferFactory>();
541 }
542
543-std::shared_ptr<EGLNativeWindowType> mtf::StubClientPlatform::create_egl_native_window(mir::client::EGLNativeSurface* surface)
544+std::shared_ptr<void> mtf::StubClientPlatform::create_egl_native_window(mir::client::EGLNativeSurface* surface)
545 {
546- auto fake_window = reinterpret_cast<EGLNativeWindowType>(surface);
547- return std::make_shared<EGLNativeWindowType>(fake_window);
548+ return std::shared_ptr<void>{surface, [](void*){}};
549 }
550
551 std::shared_ptr<EGLNativeDisplayType> mtf::StubClientPlatform::create_egl_native_display()
552
553=== modified file 'tests/unit-tests/client/test_client_buffer_stream.cpp'
554--- tests/unit-tests/client/test_client_buffer_stream.cpp 2016-02-23 20:08:23 +0000
555+++ tests/unit-tests/client/test_client_buffer_stream.cpp 2016-02-28 23:45:57 +0000
556@@ -68,9 +68,9 @@
557 void populate(MirPlatformPackage& /* package */) const override
558 {
559 }
560- std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mcl::EGLNativeSurface * /* surface */) override
561+ std::shared_ptr<void> create_egl_native_window(mcl::EGLNativeSurface * /* surface */) override
562 {
563- return std::make_shared<EGLNativeWindowType>(egl_native_window);
564+ return mt::fake_shared(egl_native_window);
565 }
566 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() override
567 {
568
569=== modified file 'tests/unit-tests/client/test_client_platform.cpp'
570--- tests/unit-tests/client/test_client_platform.cpp 2016-01-29 08:18:22 +0000
571+++ tests/unit-tests/client/test_client_platform.cpp 2016-02-28 23:45:57 +0000
572@@ -141,7 +141,7 @@
573 auto platform = create_client_platform(&context);
574 auto mock_client_surface = std::make_shared<mtd::MockEGLNativeSurface>();
575 auto native_window = platform->create_egl_native_window(mock_client_surface.get());
576- EXPECT_NE(*native_window, (EGLNativeWindowType) NULL);
577+ EXPECT_THAT(native_window.get(), testing::Ne(nullptr));
578 }
579
580 TEST_P(ClientPlatformTest, platform_creates_egl_native_display)
581
582=== modified file 'tests/unit-tests/client/test_mir_connection.cpp'
583--- tests/unit-tests/client/test_mir_connection.cpp 2016-02-23 16:12:59 +0000
584+++ tests/unit-tests/client/test_mir_connection.cpp 2016-02-28 23:45:57 +0000
585@@ -176,7 +176,7 @@
586 MOCK_CONST_METHOD0(platform_type, MirPlatformType());
587 MOCK_METHOD1(platform_operation, MirPlatformMessage*(MirPlatformMessage const*));
588 MOCK_METHOD0(create_buffer_factory, std::shared_ptr<mcl::ClientBufferFactory>());
589- MOCK_METHOD1(create_egl_native_window, std::shared_ptr<EGLNativeWindowType>(mcl::EGLNativeSurface*));
590+ MOCK_METHOD1(create_egl_native_window, std::shared_ptr<void>(mcl::EGLNativeSurface*));
591 MOCK_METHOD0(create_egl_native_display, std::shared_ptr<EGLNativeDisplayType>());
592 MOCK_CONST_METHOD2(get_egl_pixel_format,
593 MirPixelFormat(EGLDisplay, EGLConfig));

Subscribers

People subscribed via source and target branches