Skip to content

Commit 689ebde

Browse files
author
Tor Didriksen
committed
Bug#36286802 RPM packaging does "make test" even when unit tests are disabled
Change the meaning of the EXCLUDE_FROM_PGO option for misc. cmake macros/functions. We now skip building when generating profile data, but we *do* build when *using* profile data. This is done in order to be able to run unit tests also for PGO/LTO builds. There are lots of new warnings during linking: - we are building executables that were not built prior to this patch - we are doing PGO/LTO builds also for el8 (earlier only el7) Add a convenience macro DOWNGRADE_STRINGOP_WARNINGS, and use this for misc. test binaries. TODO: consider silencing these warnings completely, rather than downgrading from error to warning. A few tests fail to link on el8. The common issue is usage of std::filesystem. The solution is to skip building them altogether when doing profiling. Change some RPM spec files to run 'ctest' explicitly, rather than 'make test'. Fix a couple of 'may be used unitialized' warnings. Change-Id: I19b94c04cf13225e0d18f79d76bc79bc67c3c5e4
1 parent 8595d6f commit 689ebde

File tree

37 files changed

+89
-31
lines changed

37 files changed

+89
-31
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ IF(WIN32)
814814
OPTION(WITH_MSCRT_DEBUG "MS Visual Studio Debug CRT instrumentation" OFF)
815815
ENDIF()
816816
IF(NOT WITHOUT_SERVER)
817-
IF(FPROFILE_GENERATE OR FPROFILE_USE)
817+
IF(FPROFILE_GENERATE)
818818
# Do not use data from unit testing when optimizing.
819819
OPTION(WITH_UNIT_TESTS "Compile MySQL with unit tests" OFF)
820820
ELSE()
@@ -2672,6 +2672,7 @@ ENDIF(DOXYGEN_FOUND)
26722672

26732673
MYSQL_ADD_EXECUTABLE(stack_direction
26742674
${CMAKE_SOURCE_DIR}/cmake/stack_direction.c
2675+
EXCLUDE_FROM_PGO
26752676
SKIP_INSTALL
26762677
)
26772678

cmake/fprofile.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,12 @@ IF(FPROFILE_USE AND NOT MSVC)
182182
# LTO combined with PGO boosts performance even more.
183183
SET(WITH_LTO_DEFAULT ON CACHE INTERNAL "")
184184
ENDIF()
185+
186+
MACRO(DOWNGRADE_STRINGOP_WARNINGS target)
187+
IF(MY_COMPILER_IS_GNU AND WITH_LTO AND FPROFILE_USE)
188+
TARGET_LINK_OPTIONS(${target} PRIVATE
189+
-Wno-error=stringop-overflow
190+
-Wno-error=stringop-overread
191+
)
192+
ENDIF()
193+
ENDMACRO()

cmake/libutils.cmake

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ FUNCTION(ADD_STATIC_LIBRARY TARGET)
8383
)
8484

8585
IF(ARG_EXCLUDE_FROM_PGO)
86-
IF(FPROFILE_GENERATE OR FPROFILE_USE)
86+
IF(FPROFILE_GENERATE)
8787
RETURN()
8888
ENDIF()
8989
ENDIF()
@@ -96,12 +96,6 @@ FUNCTION(ADD_STATIC_LIBRARY TARGET)
9696
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES
9797
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/archive_output_directory)
9898

99-
IF(ARG_EXCLUDE_FROM_PGO)
100-
IF(FPROFILE_GENERATE OR FPROFILE_USE)
101-
SET(ARG_EXCLUDE_FROM_ALL TRUE)
102-
ENDIF()
103-
ENDIF()
104-
10599
IF(ARG_EXCLUDE_FROM_ALL)
106100
SET_PROPERTY(TARGET ${TARGET} PROPERTY EXCLUDE_FROM_ALL TRUE)
107101
IF(WIN32)
@@ -195,7 +189,7 @@ MACRO(ADD_CONVENIENCE_LIBRARY TARGET_ARG)
195189
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/archive_output_directory)
196190

197191
IF(ARG_EXCLUDE_FROM_PGO)
198-
IF(FPROFILE_GENERATE OR FPROFILE_USE)
192+
IF(FPROFILE_GENERATE)
199193
SET(ARG_EXCLUDE_FROM_ALL TRUE)
200194
ENDIF()
201195
ENDIF()
@@ -260,7 +254,7 @@ ENDMACRO()
260254
MACRO(MERGE_LIBRARIES_SHARED TARGET_ARG)
261255
SET(SHLIB_OPTIONS
262256
EXCLUDE_FROM_ALL
263-
EXCLUDE_FROM_PGO # add target, but do not build for PGO
257+
EXCLUDE_FROM_PGO # add target, but do not build for FPROFILE_GENERATE
264258
LINK_PUBLIC # All source libs become part of the PUBLIC interface of target.
265259
# See documentation for INTERFACE_LINK_LIBRARIES
266260
# The default is STATIC, i.e. the property
@@ -308,7 +302,7 @@ MACRO(MERGE_LIBRARIES_SHARED TARGET_ARG)
308302
ENDIF()
309303

310304
IF(ARG_EXCLUDE_FROM_PGO)
311-
IF(FPROFILE_GENERATE OR FPROFILE_USE)
305+
IF(FPROFILE_GENERATE)
312306
SET(ARG_EXCLUDE_FROM_ALL TRUE)
313307
SET(ARG_SKIP_INSTALL TRUE)
314308
ENDIF()

cmake/mysql_add_executable.cmake

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ FUNCTION(MYSQL_ADD_EXECUTABLE target_arg)
8181
# command, which is probably not what you want
8282
# (except for mysqld.lib which is used by plugins).
8383
EXCLUDE_FROM_ALL # add target, but do not build it by default
84-
EXCLUDE_FROM_PGO # add target, but do not build for PGO
84+
EXCLUDE_FROM_PGO # add target, but do not build for FPROFILE_GENERATE
8585
SKIP_INSTALL # do not install it
8686
)
8787
SET(EXECUTABLE_ONE_VALUE_KW
@@ -107,7 +107,7 @@ FUNCTION(MYSQL_ADD_EXECUTABLE target_arg)
107107
)
108108

109109
IF(ARG_EXCLUDE_FROM_PGO)
110-
IF(FPROFILE_GENERATE OR FPROFILE_USE)
110+
IF(FPROFILE_GENERATE)
111111
RETURN()
112112
ENDIF()
113113
ENDIF()
@@ -154,10 +154,11 @@ FUNCTION(MYSQL_ADD_EXECUTABLE target_arg)
154154
ENDIF()
155155

156156
IF(ARG_EXCLUDE_FROM_PGO)
157-
IF(FPROFILE_GENERATE OR FPROFILE_USE)
158-
SET(ARG_EXCLUDE_FROM_ALL TRUE)
159-
SET(ARG_SKIP_INSTALL TRUE)
160-
UNSET(ARG_ADD_TEST)
157+
IF(FPROFILE_USE)
158+
MY_CHECK_CXX_COMPILER_WARNING("-Wmissing-profile" HAS_MISSING_PROFILE)
159+
IF(HAS_MISSING_PROFILE)
160+
TARGET_COMPILE_OPTIONS(${target} PRIVATE ${HAS_MISSING_PROFILE})
161+
ENDIF()
161162
ENDIF()
162163
ENDIF()
163164

components/keyrings/keyring_file/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,5 @@ MYSQL_ADD_COMPONENT(keyring_file
8181
LINK_LIBRARIES ${KEYRING_FILE_LIBRARIES}
8282
MODULE_ONLY
8383
)
84+
85+
DOWNGRADE_STRINGOP_WARNINGS(component_keyring_file)

extra/libbacktrace/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
INCLUDE(libutils)
2525

26+
DISABLE_MISSING_PROFILE_WARNING()
27+
2628
SET(BACKTRACE_VERSION sha9ae4f4a)
2729
SET(BACKTRACE_SOURCES
2830
${BACKTRACE_VERSION}/backtrace.c

extra/libedit/libedit-20221030-3.1/src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# See src/Makefile.am for original build dependencies.
22

3+
DISABLE_MISSING_PROFILE_WARNING()
4+
35
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} )
46
INCLUDE(CheckIncludeFile)
57
include(CheckFunctionExists)

libmysql/fido_client/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# along with this program; if not, write to the Free Software
2222
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

24+
DISABLE_MISSING_PROFILE_WARNING()
25+
2426
# Common
2527
ADD_SUBDIRECTORY(common)
2628

libs/mysql/gtid/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# along with this program; if not, write to the Free Software
2222
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

24+
DISABLE_MISSING_PROFILE_WARNING()
25+
2426
SET(LINKED_LIBRARIES
2527
)
2628

libs/mysql/serialization/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# along with this program; if not, write to the Free Software
2222
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

24+
DISABLE_MISSING_PROFILE_WARNING()
25+
2426
SET(TARGET_HEADERS
2527
archive_binary_field_max_size_calculator.h
2628
archive_binary.h

0 commit comments

Comments
 (0)