Add all test.
This commit is contained in:
parent
7a3d819229
commit
915dfd2338
|
@ -6,8 +6,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TEST_LINUX_MOCK}")
|
|||
# Compile gtest for test code.
|
||||
execute_process(COMMAND sh build_gtest.sh ${TARGET_PLATFORM} ${CMAKE_SOURCE_DIR_IPCSDK} ${PLATFORM_PATH} WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/gtest/)
|
||||
# add_subdirectory(test_utils)
|
||||
# add_subdirectory(application)
|
||||
add_subdirectory(middleware)
|
||||
add_subdirectory(utils)
|
||||
add_subdirectory(hal)
|
||||
add_subdirectory(all)
|
||||
|
||||
|
|
35
test/all/CMakeLists.txt
Normal file
35
test/all/CMakeLists.txt
Normal file
|
@ -0,0 +1,35 @@
|
|||
# include(${CMAKE_SOURCE_DIR}/build/independent_source.cmake)
|
||||
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${TEST_OUTPUT_PATH}/bin)
|
||||
|
||||
include_directories(
|
||||
.
|
||||
./src
|
||||
./include
|
||||
${UTILS_SOURCE_PATH}/Log/include
|
||||
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||
${MIDDLEWARE_SOURCE_PATH}/IpcConfig/include
|
||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include
|
||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/include
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/lib
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs
|
||||
)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
aux_source_directory(. SRC_FILES)
|
||||
aux_source_directory(${TEST_SOURCE_PATH}/middleware/IpcConfig/src SRC_FILES)
|
||||
set(TARGET_NAME AllTest)
|
||||
add_executable(${TARGET_NAME} ${SRC_FILES})
|
||||
target_link_libraries(${TARGET_NAME} IpcConfig gtest gmock pthread)
|
||||
if(${COVERAGE_ON} MATCHES "true")
|
||||
target_link_libraries(${TARGET_NAME} gcov)
|
||||
endif()
|
9
test/all/mainTest.cpp
Normal file
9
test/all/mainTest.cpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <thread>
|
||||
#include <unistd.h>
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# cmake_minimum_required(VERSION 2.8.0)
|
||||
add_subdirectory(IpcConfig)
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ include_directories(
|
|||
)
|
||||
|
||||
link_directories(
|
||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/lib
|
||||
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/lib
|
||||
${LIBS_OUTPUT_PATH}
|
||||
${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs
|
||||
|
@ -26,11 +25,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
aux_source_directory(. SRC_FILES)
|
||||
aux_source_directory(. SRC_FILES_MAIN)
|
||||
aux_source_directory(./src SRC_FILES)
|
||||
|
||||
set(TARGET_NAME IpcConfigTest)
|
||||
add_executable(${TARGET_NAME} ${SRC_FILES})
|
||||
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
||||
target_link_libraries(${TARGET_NAME} IpcConfig gtest gmock pthread)
|
||||
if(${COVERAGE_ON} MATCHES "true")
|
||||
target_link_libraries(${TARGET_NAME} gcov)
|
||||
|
|
|
@ -11,6 +11,8 @@ namespace IpcConfigTest
|
|||
CreateIpcConfig();
|
||||
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||
IIpcConfig::GetInstance()->Init();
|
||||
int testNum = IIpcConfig::GetInstance()->GetInt(IpcConfigKey::TEST_NUM);
|
||||
LogInfo("Get testNum = %d\n", testNum);
|
||||
IIpcConfig::GetInstance()->UnInit();
|
||||
ILogUnInit();
|
||||
DestroyLogModule();
|
||||
|
|
|
@ -32,7 +32,7 @@ static void ConfigClose(VConfig *cfg)
|
|||
static const StatusCode ConfigGetIntImpl(VConfig *cfg, const char *name, int *value)
|
||||
{
|
||||
int result = 0;
|
||||
config_setting_t *root, *setting, *movie;
|
||||
// config_setting_t *root;
|
||||
result = config_lookup_int(&(((Config *)cfg)->cfg), name, value);
|
||||
if (CONFIG_FALSE == result)
|
||||
{
|
||||
|
@ -42,10 +42,11 @@ static const StatusCode ConfigGetIntImpl(VConfig *cfg, const char *name, int *va
|
|||
}
|
||||
static const StatusCode ConfigSetIntImpl(VConfig *cfg, const char *name, const int value)
|
||||
{
|
||||
// int result = 0;
|
||||
// config_setting_t *root, *setting, *movie;
|
||||
// root = config_root_setting(&(((Config*)cfg)->cfg));
|
||||
// setting = config_setting_get_member(root, name);
|
||||
int result = 0;
|
||||
config_setting_t *root, *setting, *movie;
|
||||
root = config_root_setting(&(((Config *)cfg)->cfg));
|
||||
setting = config_setting_add(root, name, CONFIG_TYPE_INT);
|
||||
config_setting_set_int(setting, value);
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
static void ConfigImplInit(Config *cfg)
|
||||
|
|
Loading…
Reference in New Issue
Block a user