Merge lp:~alan-griffiths/mir/fedora-gtest into lp:mir
- fedora-gtest
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4299 |
Proposed branch: | lp:~alan-griffiths/mir/fedora-gtest |
Merge into: | lp:mir |
Prerequisite: | lp:~alan-griffiths/mir/fedora |
Diff against target: |
198 lines (+59/-101) 3 files modified
CMakeLists.txt (+1/-1) cmake/FindGtestGmock.cmake (+56/-100) tests/unit-tests/test_raii.cpp (+2/-0) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/fedora-gtest |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Michał Sawicz | Approve | ||
Review via email: mp+332512@code.launchpad.net |
Commit message
Fix GMock detection on Fedora
Description of the change
Mir CI Bot (mir-ci-bot) wrote : | # |
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4300
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:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4302
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:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Michał Sawicz (saviq) wrote : | # |
Needed the following packages on top of what https:/
$ dnf install python3-pillow libevdev-devel umockdev-devel gtest-devel gmock-devel
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:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: 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) : | # |
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2017-10-23 09:52:02 +0000 | |||
3 | +++ CMakeLists.txt 2017-10-23 09:52:03 +0000 | |||
4 | @@ -298,7 +298,6 @@ | |||
5 | 298 | add_definitions(-DMIR_LIBINPUT_HAS_ACCEL_PROFILE=1) | 298 | add_definitions(-DMIR_LIBINPUT_HAS_ACCEL_PROFILE=1) |
6 | 299 | endif () | 299 | endif () |
7 | 300 | 300 | ||
8 | 301 | add_subdirectory(benchmarks/) | ||
9 | 302 | add_subdirectory(examples/) | 301 | add_subdirectory(examples/) |
10 | 303 | if (MIR_EGL_SUPPORTED) | 302 | if (MIR_EGL_SUPPORTED) |
11 | 304 | add_subdirectory(playground/) | 303 | add_subdirectory(playground/) |
12 | @@ -311,6 +310,7 @@ | |||
13 | 311 | pkg_check_modules(LIBEVDEV REQUIRED libevdev) | 310 | pkg_check_modules(LIBEVDEV REQUIRED libevdev) |
14 | 312 | include_directories(${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR}) | 311 | include_directories(${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR}) |
15 | 313 | add_subdirectory(tests/) | 312 | add_subdirectory(tests/) |
16 | 313 | add_subdirectory(benchmarks/) | ||
17 | 314 | 314 | ||
18 | 315 | # There's no nice way to format this. Thanks CMake. | 315 | # There's no nice way to format this. Thanks CMake. |
19 | 316 | mir_add_test(NAME LGPL-required | 316 | mir_add_test(NAME LGPL-required |
20 | 317 | 317 | ||
21 | === modified file 'cmake/FindGtestGmock.cmake' | |||
22 | --- cmake/FindGtestGmock.cmake 2017-10-17 09:33:03 +0000 | |||
23 | +++ cmake/FindGtestGmock.cmake 2017-10-23 09:52:03 +0000 | |||
24 | @@ -1,105 +1,61 @@ | |||
25 | 1 | include(ExternalProject) | ||
26 | 2 | include(FindPackageHandleStandardArgs) | 1 | include(FindPackageHandleStandardArgs) |
27 | 3 | 2 | ||
62 | 4 | execute_process(COMMAND "arch" OUTPUT_VARIABLE MIR_HOST_PROCESSOR OUTPUT_STRIP_TRAILING_WHITESPACE) | 3 | find_package(GTest) |
63 | 5 | 4 | ||
64 | 6 | if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${MIR_HOST_PROCESSOR}") | 5 | if (NOT GTEST_FOUND) |
65 | 7 | find_package(GMock REQUIRED) | 6 | include(ExternalProject) |
66 | 8 | if (NOT TARGET GMock) | 7 | |
67 | 9 | add_custom_target(GMock DEPENDS gmock) | 8 | find_path(GTEST_ROOT |
68 | 10 | endif() | 9 | NAMES CMakeLists.txt |
69 | 11 | else() | 10 | PATHS /usr/src/gtest /usr/src/googletest/googletest/ |
70 | 12 | # | 11 | DOC "Path to GTest CMake project") |
71 | 13 | # When cross compiling MIR_CHROOT points to our chroot. | 12 | |
72 | 14 | # When not cross compiling, it should be blank to use the host system. | 13 | ExternalProject_Add(gtest PREFIX ./gtest |
73 | 15 | # | 14 | SOURCE_DIR ${GTEST_ROOT} |
74 | 16 | set(usr ${MIR_CHROOT}/usr) | 15 | CMAKE_ARGS |
75 | 17 | 16 | -DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}' | |
76 | 18 | if (EXISTS ${usr}/src/googletest) | 17 | -DCMAKE_CXX_COMPILER_WORKS=1 |
77 | 19 | set (USING_GOOGLETEST_1_8 TRUE) | 18 | -DCMAKE_C_COMPILER_WORKS=1 |
78 | 20 | set (GTEST_INSTALL_DIR ${usr}/src/googletest/googletest/include) | 19 | -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} |
79 | 21 | else() | 20 | -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} |
80 | 22 | set (GTEST_INSTALL_DIR ${usr}/src/gmock/gtest/include) | 21 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} |
81 | 23 | endif() | 22 | -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} |
82 | 24 | 23 | INSTALL_COMMAND true) | |
83 | 25 | #gtest | 24 | |
84 | 26 | find_path( | 25 | set(GTEST_LIBRARY "-lgtest") |
85 | 27 | GTEST_INCLUDE_DIR gtest/gtest.h | 26 | set(GTEST_MAIN_LIBRARY "-lgtest_main") |
86 | 28 | HINTS ${GTEST_INSTALL_DIR} | 27 | set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY}) |
87 | 29 | ) | 28 | set(GTEST_DEPENDENCIES "gtest") |
88 | 30 | 29 | set(GTEST_FOUND TRUE) | |
89 | 31 | #gmock | 30 | find_path(GTEST_INCLUDE_DIRS NAMES gtest/gtest.h) |
90 | 32 | find_path( | 31 | link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest-build) |
91 | 33 | GMOCK_INSTALL_DIR CMakeLists.txt | 32 | find_package_handle_standard_args(GTest GTEST_LIBRARY GTEST_BOTH_LIBRARIES GTEST_INCLUDE_DIRS) |
92 | 34 | HINTS ${usr}/src/googletest ${usr}/src/gmock) | 33 | endif() |
93 | 35 | if(${GMOCK_INSTALL_DIR} STREQUAL "GMOCK_INSTALL_DIR-NOTFOUND") | 34 | |
94 | 36 | message(FATAL_ERROR "google-mock package not found") | 35 | find_file(GMOCK_SOURCE |
95 | 37 | endif() | 36 | NAMES gmock-all.cc |
96 | 37 | DOC "GMock source" | ||
97 | 38 | PATHS /usr/src/googletest/googlemock/src/ /usr/src/gmock/ /usr/src/gmock/src) | ||
98 | 39 | |||
99 | 40 | message(STATUS "GMOCK_SOURCE=${GMOCK_SOURCE}") | ||
100 | 38 | 41 | ||
101 | 39 | find_path(GMOCK_INCLUDE_DIR gmock/gmock.h) | 42 | find_path(GMOCK_INCLUDE_DIR gmock/gmock.h) |
102 | 40 | 43 | ||
168 | 41 | if (USING_GOOGLETEST_1_8) | 44 | add_library(GMock STATIC ${GMOCK_SOURCE}) |
169 | 42 | set(GMOCK_BASE_BINARY_DIR ${CMAKE_BINARY_DIR}/gmock/libs) | 45 | |
170 | 43 | set(GMOCK_BINARY_DIR ${GMOCK_BASE_BINARY_DIR}/googlemock) | 46 | if (EXISTS /usr/src/googletest/googlemock/src) |
171 | 44 | set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest) | 47 | set_source_files_properties(${GMOCK_SOURCE} PROPERTIES COMPILE_FLAGS "-I/usr/src/googletest/googlemock") |
172 | 45 | else() | 48 | endif() |
173 | 46 | set(GMOCK_BASE_BINARY_DIR ${CMAKE_BINARY_DIR}/gmock/libs) | 49 | |
174 | 47 | set(GMOCK_BINARY_DIR ${GMOCK_BASE_BINARY_DIR}) | 50 | if (EXISTS /usr/src/gmock/src) |
175 | 48 | set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest) | 51 | set_source_files_properties(${GMOCK_SOURCE} PROPERTIES COMPILE_FLAGS "-I/usr/src/gmock") |
176 | 49 | endif() | 52 | endif() |
177 | 50 | 53 | ||
178 | 51 | set(GTEST_CXX_FLAGS "-fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64") | 54 | if (TARGET gtest) |
179 | 52 | if (cmake_build_type_lower MATCHES "threadsanitizer") | 55 | add_dependencies(GMock gtest) |
180 | 53 | set(GTEST_CXX_FLAGS "${GTEST_CXX_FLAGS} -fsanitize=thread") | 56 | endif() |
181 | 54 | elseif (cmake_build_type_lower MATCHES "ubsanitizer") | 57 | |
182 | 55 | set(GTEST_CXX_FLAGS "${GTEST_CXX_FLAGS} -fsanitize=undefined") | 58 | find_package_handle_standard_args(GMock DEFAULT_MSG GMOCK_INCLUDE_DIR) |
183 | 56 | endif() | 59 | |
184 | 57 | 60 | set(GMOCK_LIBRARY GMock) | |
185 | 58 | set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${GTEST_CXX_FLAGS}") | 61 | set(GMOCK_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARY}) |
121 | 59 | list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) | ||
122 | 60 | list(APPEND GTEST_CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) | ||
123 | 61 | |||
124 | 62 | if (USING_GOOGLETEST_1_8) | ||
125 | 63 | list(APPEND GTEST_CMAKE_ARGS -DBUILD_GTEST=ON) | ||
126 | 64 | endif() | ||
127 | 65 | |||
128 | 66 | if (cmake_build_type_lower MATCHES "threadsanitizer") | ||
129 | 67 | #Skip compiler check, since if GCC is the compiler, we need to link against -ltsan | ||
130 | 68 | #explicitly; specifying additional linker flags doesn't seem possible for external projects | ||
131 | 69 | list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER_WORKS=1) | ||
132 | 70 | endif() | ||
133 | 71 | if (${CMAKE_CROSSCOMPILING}) | ||
134 | 72 | if(DEFINED MIR_CHROOT) | ||
135 | 73 | list(APPEND GTEST_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_MODULE_PATH}/LinuxCrossCompile.cmake) | ||
136 | 74 | else() | ||
137 | 75 | list(APPEND GTEST_CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) | ||
138 | 76 | list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) | ||
139 | 77 | endif() | ||
140 | 78 | endif() | ||
141 | 79 | |||
142 | 80 | ExternalProject_Add( | ||
143 | 81 | GMock | ||
144 | 82 | #where to build in source tree | ||
145 | 83 | PREFIX ${GMOCK_PREFIX} | ||
146 | 84 | #where the source is external to the project | ||
147 | 85 | SOURCE_DIR ${GMOCK_INSTALL_DIR} | ||
148 | 86 | #forward the compilers to the subproject so cross-arch builds work | ||
149 | 87 | CMAKE_ARGS ${GTEST_CMAKE_ARGS} | ||
150 | 88 | BINARY_DIR ${GMOCK_BASE_BINARY_DIR} | ||
151 | 89 | |||
152 | 90 | #we don't need to install, so skip | ||
153 | 91 | INSTALL_COMMAND "" | ||
154 | 92 | ) | ||
155 | 93 | |||
156 | 94 | set(GMOCK_LIBRARY ${GMOCK_BINARY_DIR}/libgmock.a) | ||
157 | 95 | set(GMOCK_MAIN_LIBRARY ${GMOCK_BINARY_DIR}/libgmock_main.a) | ||
158 | 96 | set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARY} ${GMOCK_MAIN_LIBRARY}) | ||
159 | 97 | set(GTEST_LIBRARY ${GTEST_BINARY_DIR}/libgtest.a) | ||
160 | 98 | set(GTEST_MAIN_LIBRARY ${GTEST_BINARY_DIR}/libgtest_main.a) | ||
161 | 99 | set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY}) | ||
162 | 100 | set(GMOCK_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${GMOCK_BOTH_LIBRARIES}) | ||
163 | 101 | |||
164 | 102 | find_package_handle_standard_args(GTest DEFAULT_MSG | ||
165 | 103 | GMOCK_INCLUDE_DIR | ||
166 | 104 | GTEST_INCLUDE_DIR) | ||
167 | 105 | endif() | ||
186 | 106 | 62 | ||
187 | === modified file 'tests/unit-tests/test_raii.cpp' | |||
188 | --- tests/unit-tests/test_raii.cpp 2017-07-28 17:00:43 +0000 | |||
189 | +++ tests/unit-tests/test_raii.cpp 2017-10-23 09:52:03 +0000 | |||
190 | @@ -21,6 +21,8 @@ | |||
191 | 21 | #include <gtest/gtest.h> | 21 | #include <gtest/gtest.h> |
192 | 22 | #include <gmock/gmock.h> | 22 | #include <gmock/gmock.h> |
193 | 23 | 23 | ||
194 | 24 | #include <functional> | ||
195 | 25 | |||
196 | 24 | namespace | 26 | namespace |
197 | 25 | { | 27 | { |
198 | 26 | struct RaiiTest : public ::testing::Test | 28 | struct RaiiTest : public ::testing::Test |
PASSED: Continuous integration, rev:4298 /mir-jenkins. ubuntu. com/job/ mir-ci/ 3745/ /mir-jenkins. ubuntu. com/job/ build-mir/ 5149 /mir-jenkins. ubuntu. com/job/ build-0- fetch/5387 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= artful/ 5374 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial/ 5374 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= zesty/5374 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= artful/ 5193 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= artful/ 5193/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/5193 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/5193/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= artful/ 5193 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= artful/ 5193/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 5193 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 5193/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/5193 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/5193/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= mesa,release= artful/ 5193 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= mesa,release= artful/ 5193/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= mesa,release= zesty/5193 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= mesa,release= zesty/5193/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial/ 5193 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial/ 5193/artifact/ output/ *zip*/output. zip
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:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 3745/rebuild
https:/