加入test脚本
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
cmake_minimum_required( VERSION 3.28)
|
cmake_minimum_required( VERSION 3.28)
|
||||||
|
project(Logging)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
|
set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
|
||||||
set(ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
|
set(ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
|
||||||
|
|||||||
@@ -9,16 +9,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define RED "\033[0;31m"
|
#define RED "\033[0;31m"
|
||||||
#define RED_B "\033[0;41m"
|
#define RED_B "\033[0;41m"
|
||||||
#define GREEN "\033[0;32m"
|
#define GREEN "\033[0;32m"
|
||||||
#define YELLOW "\033[0;33m"
|
#define YELLOW "\033[0;33m"
|
||||||
#define BLUE "\033[0;34m"
|
#define BLUE "\033[0;34m"
|
||||||
#define RESET "\033[0m"
|
#define RESET "\033[0m"
|
||||||
#define CYAN "\033[0;36m"
|
#define CYAN "\033[0;36m"
|
||||||
#define MAGENTA "\033[0;35m"
|
|
||||||
#define WHITE "\033[0;37m"
|
|
||||||
#define BLACK "\033[0;30m"
|
|
||||||
|
|
||||||
#define LOG_BUFFER_SIZE 1024
|
#define LOG_BUFFER_SIZE 1024
|
||||||
|
|
||||||
|
|||||||
1
test.sh
Executable file
1
test.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
mkdir -p build && cd build && cmake .. && make && ctest
|
||||||
@@ -1,8 +1,14 @@
|
|||||||
project(test)
|
project(test)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
#测试简单基本应用
|
||||||
add_executable(${PROJECT_NAME}simple test_simple.c)
|
add_executable(${PROJECT_NAME}simple test_simple.c)
|
||||||
target_link_libraries(${PROJECT_NAME}simple Logging)
|
target_link_libraries(${PROJECT_NAME}simple Logging)
|
||||||
|
add_test(test_simple ${CMAKE_SOURCE_DIR}/bin/${PROJECT_NAME}simple)
|
||||||
|
|
||||||
|
|
||||||
|
#测试拦截器
|
||||||
add_executable(${PROJECT_NAME}interceptor test_interceptor.c)
|
add_executable(${PROJECT_NAME}interceptor test_interceptor.c)
|
||||||
target_link_libraries(${PROJECT_NAME}interceptor Logging)
|
target_link_libraries(${PROJECT_NAME}interceptor Logging)
|
||||||
|
add_test(test_interceptor ${CMAKE_SOURCE_DIR}/bin/${PROJECT_NAME}interceptor)
|
||||||
Reference in New Issue
Block a user