提交 49e47d4b 编写于 作者: H haozi007

improve ut manager

Signed-off-by: Nhaozi007 <liuhao27@huawei.com>
上级 6ea0a426
...@@ -33,6 +33,8 @@ if (DEBUG STREQUAL "ON") ...@@ -33,6 +33,8 @@ if (DEBUG STREQUAL "ON")
add_definitions("-g -o2") add_definitions("-g -o2")
endif() endif()
option(ENABLE_UT "enable ut" OFF)
include(cmake/set_build_flags.cmake) include(cmake/set_build_flags.cmake)
...@@ -86,7 +88,9 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party) ...@@ -86,7 +88,9 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src)
# ut and gcoverage # ut and gcoverage
add_subdirectory(tests) if (ENABLE_UT)
add_subdirectory(tests)
endif()
# install all files # install all files
install(FILES ${CMAKE_BINARY_DIR}/conf/lcr.pc install(FILES ${CMAKE_BINARY_DIR}/conf/lcr.pc
......
...@@ -69,21 +69,23 @@ find_library(LIBYAJL_LIBRARY yajl ...@@ -69,21 +69,23 @@ find_library(LIBYAJL_LIBRARY yajl
HINTS ${PC_LIBYAJL_LIBDIR} ${PC_LIBYAJL_LIBRARY_DIRS}) HINTS ${PC_LIBYAJL_LIBDIR} ${PC_LIBYAJL_LIBRARY_DIRS})
_CHECK(LIBYAJL_LIBRARY "LIBYAJL_LIBRARY-NOTFOUND" "libyajl.so") _CHECK(LIBYAJL_LIBRARY "LIBYAJL_LIBRARY-NOTFOUND" "libyajl.so")
pkg_check_modules(PC_GTEST "gtest") if (ENABLE_UT)
find_path(GTEST_INCLUDE_DIR gtest/gtest.h pkg_check_modules(PC_GTEST "gtest")
HINTS ${PC_GTEST_INCLUDEDIR} ${PC_GTEST_INCLUDE_DIRS}) find_path(GTEST_INCLUDE_DIR gtest/gtest.h
_CHECK(GTEST_INCLUDE_DIR "GTEST_INCLUDE_DIR-NOTFOUND" "gtest.h") HINTS ${PC_GTEST_INCLUDEDIR} ${PC_GTEST_INCLUDE_DIRS})
find_library(GTEST_LIBRARY gtest _CHECK(GTEST_INCLUDE_DIR "GTEST_INCLUDE_DIR-NOTFOUND" "gtest.h")
HINTS ${PC_GTEST_LIBDIR} ${PC_GTEST_LIBRARY_DIRS}) find_library(GTEST_LIBRARY gtest
_CHECK(GTEST_LIBRARY "GTEST_LIBRARY-NOTFOUND" "libgtest.so") HINTS ${PC_GTEST_LIBDIR} ${PC_GTEST_LIBRARY_DIRS})
_CHECK(GTEST_LIBRARY "GTEST_LIBRARY-NOTFOUND" "libgtest.so")
pkg_check_modules(PC_GMOCK "gmock") pkg_check_modules(PC_GMOCK "gmock")
find_path(GMOCK_INCLUDE_DIR gmock/gmock.h find_path(GMOCK_INCLUDE_DIR gmock/gmock.h
HINTS ${PC_GMOCK_INCLUDEDIR} ${PC_GMOCK_INCLUDE_DIRS}) HINTS ${PC_GMOCK_INCLUDEDIR} ${PC_GMOCK_INCLUDE_DIRS})
_CHECK(GMOCK_INCLUDE_DIR "GMOCK_INCLUDE_DIR-NOTFOUND" "gmock.h") _CHECK(GMOCK_INCLUDE_DIR "GMOCK_INCLUDE_DIR-NOTFOUND" "gmock.h")
find_library(GMOCK_LIBRARY z find_library(GMOCK_LIBRARY z
HINTS ${PC_GMOCK_LIBDIR} ${PC_GMOCK_LIBRARY_DIRS}) HINTS ${PC_GMOCK_LIBDIR} ${PC_GMOCK_LIBRARY_DIRS})
_CHECK(GMOCK_LIBRARY "GMOCK_LIBRARY-NOTFOUND" "libgmock.so") _CHECK(GMOCK_LIBRARY "GMOCK_LIBRARY-NOTFOUND" "libgmock.so")
endif()
if (ENABLE_GCOV) if (ENABLE_GCOV)
find_program(CMD_GCOV gcov) find_program(CMD_GCOV gcov)
......
%global _version 2.0.2 %global _version 2.0.2
%global _release 20200609.145938.gita2be0373 %global _release 20200707.190329.git615e13a5
%global _inner_name isula_libutils %global _inner_name isula_libutils
Name: lcr Name: lcr
...@@ -55,7 +55,7 @@ the %{name}-libs package contains libraries for running iSula applications. ...@@ -55,7 +55,7 @@ the %{name}-libs package contains libraries for running iSula applications.
%build %build
mkdir -p build mkdir -p build
cd build cd build
%cmake -DDEBUG=OFF -DLIB_INSTALL_DIR=%{_libdir} ../ %cmake -DDEBUG=OFF -DENABLE_UT=ON -DLIB_INSTALL_DIR=%{_libdir} ../
%make_build %make_build
%install %install
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册