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 | add_definitions(-DMIR_LIBINPUT_HAS_ACCEL_PROFILE=1) |
6 | endif () |
7 | |
8 | -add_subdirectory(benchmarks/) |
9 | add_subdirectory(examples/) |
10 | if (MIR_EGL_SUPPORTED) |
11 | add_subdirectory(playground/) |
12 | @@ -311,6 +310,7 @@ |
13 | pkg_check_modules(LIBEVDEV REQUIRED libevdev) |
14 | include_directories(${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR}) |
15 | add_subdirectory(tests/) |
16 | + add_subdirectory(benchmarks/) |
17 | |
18 | # There's no nice way to format this. Thanks CMake. |
19 | mir_add_test(NAME LGPL-required |
20 | |
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 | -include(ExternalProject) |
26 | include(FindPackageHandleStandardArgs) |
27 | |
28 | -execute_process(COMMAND "arch" OUTPUT_VARIABLE MIR_HOST_PROCESSOR OUTPUT_STRIP_TRAILING_WHITESPACE) |
29 | - |
30 | -if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${MIR_HOST_PROCESSOR}") |
31 | - find_package(GMock REQUIRED) |
32 | - if (NOT TARGET GMock) |
33 | - add_custom_target(GMock DEPENDS gmock) |
34 | - endif() |
35 | -else() |
36 | -# |
37 | -# When cross compiling MIR_CHROOT points to our chroot. |
38 | -# When not cross compiling, it should be blank to use the host system. |
39 | -# |
40 | -set(usr ${MIR_CHROOT}/usr) |
41 | - |
42 | -if (EXISTS ${usr}/src/googletest) |
43 | - set (USING_GOOGLETEST_1_8 TRUE) |
44 | - set (GTEST_INSTALL_DIR ${usr}/src/googletest/googletest/include) |
45 | -else() |
46 | - set (GTEST_INSTALL_DIR ${usr}/src/gmock/gtest/include) |
47 | -endif() |
48 | - |
49 | -#gtest |
50 | -find_path( |
51 | - GTEST_INCLUDE_DIR gtest/gtest.h |
52 | - HINTS ${GTEST_INSTALL_DIR} |
53 | -) |
54 | - |
55 | -#gmock |
56 | -find_path( |
57 | - GMOCK_INSTALL_DIR CMakeLists.txt |
58 | - HINTS ${usr}/src/googletest ${usr}/src/gmock) |
59 | -if(${GMOCK_INSTALL_DIR} STREQUAL "GMOCK_INSTALL_DIR-NOTFOUND") |
60 | - message(FATAL_ERROR "google-mock package not found") |
61 | -endif() |
62 | +find_package(GTest) |
63 | + |
64 | +if (NOT GTEST_FOUND) |
65 | + include(ExternalProject) |
66 | + |
67 | + find_path(GTEST_ROOT |
68 | + NAMES CMakeLists.txt |
69 | + PATHS /usr/src/gtest /usr/src/googletest/googletest/ |
70 | + DOC "Path to GTest CMake project") |
71 | + |
72 | + ExternalProject_Add(gtest PREFIX ./gtest |
73 | + SOURCE_DIR ${GTEST_ROOT} |
74 | + CMAKE_ARGS |
75 | + -DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}' |
76 | + -DCMAKE_CXX_COMPILER_WORKS=1 |
77 | + -DCMAKE_C_COMPILER_WORKS=1 |
78 | + -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} |
79 | + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} |
80 | + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} |
81 | + -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} |
82 | + INSTALL_COMMAND true) |
83 | + |
84 | + set(GTEST_LIBRARY "-lgtest") |
85 | + set(GTEST_MAIN_LIBRARY "-lgtest_main") |
86 | + set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY}) |
87 | + set(GTEST_DEPENDENCIES "gtest") |
88 | + set(GTEST_FOUND TRUE) |
89 | + find_path(GTEST_INCLUDE_DIRS NAMES gtest/gtest.h) |
90 | + link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest-build) |
91 | + find_package_handle_standard_args(GTest GTEST_LIBRARY GTEST_BOTH_LIBRARIES GTEST_INCLUDE_DIRS) |
92 | +endif() |
93 | + |
94 | +find_file(GMOCK_SOURCE |
95 | + NAMES gmock-all.cc |
96 | + DOC "GMock source" |
97 | + PATHS /usr/src/googletest/googlemock/src/ /usr/src/gmock/ /usr/src/gmock/src) |
98 | + |
99 | +message(STATUS "GMOCK_SOURCE=${GMOCK_SOURCE}") |
100 | |
101 | find_path(GMOCK_INCLUDE_DIR gmock/gmock.h) |
102 | |
103 | -if (USING_GOOGLETEST_1_8) |
104 | - set(GMOCK_BASE_BINARY_DIR ${CMAKE_BINARY_DIR}/gmock/libs) |
105 | - set(GMOCK_BINARY_DIR ${GMOCK_BASE_BINARY_DIR}/googlemock) |
106 | - set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest) |
107 | -else() |
108 | - set(GMOCK_BASE_BINARY_DIR ${CMAKE_BINARY_DIR}/gmock/libs) |
109 | - set(GMOCK_BINARY_DIR ${GMOCK_BASE_BINARY_DIR}) |
110 | - set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest) |
111 | -endif() |
112 | - |
113 | -set(GTEST_CXX_FLAGS "-fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64") |
114 | -if (cmake_build_type_lower MATCHES "threadsanitizer") |
115 | - set(GTEST_CXX_FLAGS "${GTEST_CXX_FLAGS} -fsanitize=thread") |
116 | -elseif (cmake_build_type_lower MATCHES "ubsanitizer") |
117 | - set(GTEST_CXX_FLAGS "${GTEST_CXX_FLAGS} -fsanitize=undefined") |
118 | -endif() |
119 | - |
120 | -set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${GTEST_CXX_FLAGS}") |
121 | -list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) |
122 | -list(APPEND GTEST_CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) |
123 | - |
124 | -if (USING_GOOGLETEST_1_8) |
125 | - list(APPEND GTEST_CMAKE_ARGS -DBUILD_GTEST=ON) |
126 | -endif() |
127 | - |
128 | -if (cmake_build_type_lower MATCHES "threadsanitizer") |
129 | - #Skip compiler check, since if GCC is the compiler, we need to link against -ltsan |
130 | - #explicitly; specifying additional linker flags doesn't seem possible for external projects |
131 | - list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER_WORKS=1) |
132 | -endif() |
133 | -if (${CMAKE_CROSSCOMPILING}) |
134 | - if(DEFINED MIR_CHROOT) |
135 | - list(APPEND GTEST_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_MODULE_PATH}/LinuxCrossCompile.cmake) |
136 | - else() |
137 | - list(APPEND GTEST_CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) |
138 | - list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) |
139 | - endif() |
140 | -endif() |
141 | - |
142 | -ExternalProject_Add( |
143 | - GMock |
144 | - #where to build in source tree |
145 | - PREFIX ${GMOCK_PREFIX} |
146 | - #where the source is external to the project |
147 | - SOURCE_DIR ${GMOCK_INSTALL_DIR} |
148 | - #forward the compilers to the subproject so cross-arch builds work |
149 | - CMAKE_ARGS ${GTEST_CMAKE_ARGS} |
150 | - BINARY_DIR ${GMOCK_BASE_BINARY_DIR} |
151 | - |
152 | - #we don't need to install, so skip |
153 | - INSTALL_COMMAND "" |
154 | -) |
155 | - |
156 | -set(GMOCK_LIBRARY ${GMOCK_BINARY_DIR}/libgmock.a) |
157 | -set(GMOCK_MAIN_LIBRARY ${GMOCK_BINARY_DIR}/libgmock_main.a) |
158 | -set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARY} ${GMOCK_MAIN_LIBRARY}) |
159 | -set(GTEST_LIBRARY ${GTEST_BINARY_DIR}/libgtest.a) |
160 | -set(GTEST_MAIN_LIBRARY ${GTEST_BINARY_DIR}/libgtest_main.a) |
161 | -set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY}) |
162 | -set(GMOCK_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${GMOCK_BOTH_LIBRARIES}) |
163 | - |
164 | -find_package_handle_standard_args(GTest DEFAULT_MSG |
165 | - GMOCK_INCLUDE_DIR |
166 | - GTEST_INCLUDE_DIR) |
167 | -endif() |
168 | +add_library(GMock STATIC ${GMOCK_SOURCE}) |
169 | + |
170 | +if (EXISTS /usr/src/googletest/googlemock/src) |
171 | + set_source_files_properties(${GMOCK_SOURCE} PROPERTIES COMPILE_FLAGS "-I/usr/src/googletest/googlemock") |
172 | +endif() |
173 | + |
174 | +if (EXISTS /usr/src/gmock/src) |
175 | + set_source_files_properties(${GMOCK_SOURCE} PROPERTIES COMPILE_FLAGS "-I/usr/src/gmock") |
176 | +endif() |
177 | + |
178 | +if (TARGET gtest) |
179 | + add_dependencies(GMock gtest) |
180 | +endif() |
181 | + |
182 | +find_package_handle_standard_args(GMock DEFAULT_MSG GMOCK_INCLUDE_DIR) |
183 | + |
184 | +set(GMOCK_LIBRARY GMock) |
185 | +set(GMOCK_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARY}) |
186 | |
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 | #include <gtest/gtest.h> |
192 | #include <gmock/gmock.h> |
193 | |
194 | +#include <functional> |
195 | + |
196 | namespace |
197 | { |
198 | 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:/