* Move getFQDNOrHostName to base/common/
* Add argsToConfig to ya.make
* Add coverage.cpp to ya.make
  Also remove WITH_COVERAGE from config file
This commit is contained in:
Ivan 2020-03-18 21:54:27 +03:00 committed by GitHub
parent 40649ed0bb
commit 38b2dec354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 53 additions and 35 deletions

View File

@ -186,11 +186,13 @@ if (COMPILER_GCC OR COMPILER_CLANG)
endif ()
option(WITH_COVERAGE "Build with coverage." 0)
if(WITH_COVERAGE AND COMPILER_CLANG)
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
# If we want to disable coverage for specific translation units
set(WITHOUT_COVERAGE "-fno-profile-instr-generate -fno-coverage-mapping")
endif()
if(WITH_COVERAGE AND COMPILER_GCC)
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fprofile-arcs -ftest-coverage")
set(COVERAGE_OPTION "-lgcov")

View File

@ -6,6 +6,7 @@ set (SRCS
DateLUT.cpp
DateLUTImpl.cpp
demangle.cpp
getFQDNOrHostName.cpp
getMemoryAmount.cpp
getThreadId.cpp
JSON.cpp
@ -20,15 +21,9 @@ set (SRCS
)
if (ENABLE_REPLXX)
set (SRCS ${SRCS}
ReplxxLineReader.cpp
ReplxxLineReader.h
)
list (APPEND SRCS ReplxxLineReader.cpp)
elseif (ENABLE_READLINE)
set (SRCS ${SRCS}
ReadlineLineReader.cpp
ReadlineLineReader.h
)
list (APPEND SRCS ReadlineLineReader.cpp)
endif ()
if (USE_DEBUG_HELPERS)
@ -38,6 +33,12 @@ endif ()
add_library (common ${SRCS})
if (WITH_COVERAGE)
target_compile_definitions(common PUBLIC WITH_COVERAGE=1)
else ()
target_compile_definitions(common PUBLIC WITH_COVERAGE=0)
endif ()
target_include_directories(common PUBLIC .. ${CMAKE_CURRENT_BINARY_DIR}/..)
if(CCTZ_INCLUDE_DIR)
@ -56,8 +57,6 @@ if(CCTZ_LIBRARY)
target_link_libraries(common PRIVATE ${CCTZ_LIBRARY})
endif()
target_link_libraries(common PUBLIC replxx)
# allow explicitly fallback to readline
if (NOT ENABLE_REPLXX AND ENABLE_READLINE)
message (STATUS "Attempt to fallback to readline explicitly")
@ -82,11 +81,13 @@ endif ()
target_link_libraries (common
PUBLIC
${Poco_Net_LIBRARY}
${Poco_Util_LIBRARY}
${Poco_Foundation_LIBRARY}
${CITYHASH_LIBRARIES}
${Boost_SYSTEM_LIBRARY}
FastMemcpy
replxx
)
if (ENABLE_TESTS)

View File

@ -1,4 +1,4 @@
#include <common/argsToConfig.h>
#include "argsToConfig.h"
#include <Poco/Util/Application.h>
#include <Poco/Util/LayeredConfiguration.h>

View File

@ -1,4 +1,5 @@
#pragma once
#include <Poco/Util/Application.h>
namespace Poco::Util

View File

@ -4,4 +4,3 @@
#cmakedefine01 USE_JEMALLOC
#cmakedefine01 UNBUNDLED
#cmakedefine01 WITH_COVERAGE

View File

@ -1,16 +1,17 @@
#include <common/coverage.h>
#include <common/config_common.h>
#include "coverage.h"
#if WITH_COVERAGE
#include <unistd.h>
#include <mutex>
# include <mutex>
#if defined(__clang__)
# include <unistd.h>
# if defined(__clang__)
extern "C" void __llvm_profile_dump();
#elif defined(__GNUC__) || defined(__GNUG__)
# elif defined(__GNUC__) || defined(__GNUG__)
extern "C" void __gcov_exit();
#endif
# endif
#endif
@ -21,11 +22,11 @@ void dumpCoverageReportIfPossible()
static std::mutex mutex;
std::lock_guard lock(mutex);
#if defined(__clang__)
# if defined(__clang__)
__llvm_profile_dump();
#elif defined(__GNUC__) || defined(__GNUG__)
# elif defined(__GNUC__) || defined(__GNUG__)
__gcov_exit();
#endif
# endif
#endif
}

View File

@ -1,5 +1,5 @@
#include <Poco/Net/DNS.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
namespace

12
base/common/ya.make Normal file
View File

@ -0,0 +1,12 @@
LIBRARY()
PEERDIR(
contrib/libs/poco/Util
)
SRCS(
argsToConfig.cpp
coverage.cpp
)
END()

View File

@ -2,7 +2,7 @@
#include <daemon/BaseDaemon.h>
#include <Poco/Util/LayeredConfiguration.h>
#include <Poco/Util/Application.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <mutex>
#include <iomanip>

View File

@ -1 +1,3 @@
RECURSE(
common
)

View File

@ -19,7 +19,7 @@
#include <Common/Exception.h>
#include <Common/ZooKeeper/ZooKeeper.h>
#include <Common/ZooKeeper/KeeperException.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <Common/isLocalAddress.h>
#include <Common/typeid_cast.h>
#include <Common/ClickHouseRevision.h>

View File

@ -6,7 +6,7 @@
#include <thread>
#include <Common/getNumberOfPhysicalCPUCores.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <common/getMemoryAmount.h>
#include <Common/StringUtils/StringUtils.h>

View File

@ -12,7 +12,7 @@
#include <Core/ExternalTable.h>
#include <Common/StringUtils/StringUtils.h>
#include <Common/escapeForFileName.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <Common/CurrentThread.h>
#include <Common/setThreadName.h>
#include <Common/config.h>

View File

@ -1,7 +1,7 @@
#pragma once
#include <Common/config.h>
#include <Poco/Net/TCPServerConnection.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <Common/CurrentMetrics.h>
#include <Core/MySQLProtocol.h>
#include "IServer.h"

View File

@ -27,7 +27,7 @@
#include <Common/ZooKeeper/ZooKeeper.h>
#include <Common/ZooKeeper/ZooKeeperNodeCache.h>
#include "config_core.h"
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <Common/getMultipleKeysFromConfig.h>
#include <Common/getNumberOfPhysicalCPUCores.h>
#include <Common/getExecutablePath.h>

View File

@ -2,7 +2,7 @@
#include <Poco/Net/TCPServerConnection.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <Common/CurrentMetrics.h>
#include <Common/Stopwatch.h>
#include <Core/Protocol.h>

View File

@ -4,7 +4,7 @@
#include <Poco/Net/DNS.h>
#include <Common/BitHelpers.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <Common/isLocalAddress.h>
#include <Common/ProfileEvents.h>
#include <Core/Settings.h>

View File

@ -1,7 +1,7 @@
#include <Functions/IFunctionImpl.h>
#include <Functions/FunctionFactory.h>
#include <DataTypes/DataTypeString.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <Core/Field.h>

View File

@ -4,7 +4,7 @@
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <Core/Defines.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <Common/ClickHouseRevision.h>
#include <Common/config_version.h>
#include <unistd.h>

View File

@ -20,7 +20,7 @@
#include <Access/AccessRightsElement.h>
#include <Common/DNSResolver.h>
#include <Common/Macros.h>
#include <Common/getFQDNOrHostName.h>
#include <common/getFQDNOrHostName.h>
#include <Common/setThreadName.h>
#include <Common/Stopwatch.h>
#include <Common/randomSeed.h>