Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ed1582309 | ||
|
|
67ed711088 |
@@ -7,6 +7,7 @@ variables:
|
|||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
.build_before_script:
|
.build_before_script:
|
||||||
before_script:
|
before_script:
|
||||||
@@ -41,6 +42,26 @@ stages:
|
|||||||
tags:
|
tags:
|
||||||
- share
|
- share
|
||||||
|
|
||||||
|
run_test_for_centos7:
|
||||||
|
stage: test
|
||||||
|
image: $BUILD_IMAGE_CENTOS7
|
||||||
|
extends: .build_by_travis_for_centos7
|
||||||
|
script:
|
||||||
|
- yum makecache
|
||||||
|
- ./ci/travis.sh
|
||||||
|
- cd build
|
||||||
|
- ctest --verbose
|
||||||
|
|
||||||
|
run_test_for_centos8:
|
||||||
|
stage: test
|
||||||
|
image: $BUILD_IMAGE_CENTOS8
|
||||||
|
extends: .build_by_travis_for_centos8
|
||||||
|
script:
|
||||||
|
- yum makecache
|
||||||
|
- ./ci/travis.sh
|
||||||
|
- cd build
|
||||||
|
- ctest --verbose
|
||||||
|
|
||||||
branch_build_debug_for_centos7:
|
branch_build_debug_for_centos7:
|
||||||
stage: build
|
stage: build
|
||||||
extends: .build_by_travis_for_centos7
|
extends: .build_by_travis_for_centos7
|
||||||
|
|||||||
@@ -69,4 +69,9 @@ install(FILES conf/MESA_handle_logger.conf DESTINATION /usr/lib/tmpfiles.d/ COMP
|
|||||||
add_executable(${lib_name}_demo demo/test_handle_logger.c)
|
add_executable(${lib_name}_demo demo/test_handle_logger.c)
|
||||||
target_link_libraries(${lib_name}_demo pthread ${lib_name}_shared)
|
target_link_libraries(${lib_name}_demo pthread ${lib_name}_shared)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
add_test(NAME test_compatible_mode COMMAND MESA_handle_logger_demo 1 ./demo_zlog.conf 1 100 0)
|
||||||
|
add_test(NAME test_perf COMMAND MESA_handle_logger_demo 2 ./demo_zlog.conf 1 1000 0)
|
||||||
|
|
||||||
include(Package)
|
include(Package)
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ int main(int argc, char ** args)
|
|||||||
{
|
{
|
||||||
pthread_t t[MAX_THREAD_NUM];
|
pthread_t t[MAX_THREAD_NUM];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
int ret =0;
|
||||||
|
|
||||||
if (argc != 6)
|
if (argc != 6)
|
||||||
{
|
{
|
||||||
@@ -136,26 +137,35 @@ int main(int argc, char ** args)
|
|||||||
{
|
{
|
||||||
printf("get log sample_handle error\n");
|
printf("get log sample_handle error\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
test_handle = MESA_create_runtime_log_handle("./log/test_log", RLOG_LV_DEBUG);
|
test_handle = MESA_create_runtime_log_handle("./log/test_log", RLOG_LV_DEBUG);
|
||||||
if(test_handle == NULL)
|
if (test_handle == NULL)
|
||||||
{
|
{
|
||||||
printf("get log test_handle error\n");
|
printf("get log test_handle error\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < g_thread_num; i++)
|
for (i = 0; i < g_thread_num; i++)
|
||||||
{
|
{
|
||||||
pthread_create(&t[i], NULL, thread_logger, (void *)(unsigned long)(i));
|
pthread_create(&t[i], NULL, thread_logger, (void *)(unsigned long)(i));
|
||||||
}
|
}
|
||||||
signal(SIGINT, sig_int_handler);
|
signal(SIGINT, sig_int_handler);
|
||||||
signal(SIGHUP, sig_hup_handler);
|
signal(SIGHUP, sig_hup_handler);
|
||||||
while(1)
|
|
||||||
;
|
// 等待所有线程结束并回收
|
||||||
//MESA_destroy_runtime_log_handle(sample_handle);
|
for (i = 0; i < g_thread_num; ++i) {
|
||||||
//MESA_destroy_runtime_log_handle(test_handle);
|
ret = pthread_join(t[i], NULL);
|
||||||
//sample_handle = NULL;
|
if (ret != 0) {
|
||||||
//test_handle = NULL;
|
fprintf(stderr, "Failed to join thread %d\n", i);
|
||||||
return 0;
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("All threads finished\n");
|
||||||
|
// MESA_destroy_runtime_log_handle(sample_handle);
|
||||||
|
// MESA_destroy_runtime_log_handle(test_handle);
|
||||||
|
// sample_handle = NULL;
|
||||||
|
// test_handle = NULL;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,21 +23,15 @@ int MESA_handle_runtime_log_creation(const char *conf_path);
|
|||||||
int MESA_handle_runtime_log_reconstruction(const char *conf_path);
|
int MESA_handle_runtime_log_reconstruction(const char *conf_path);
|
||||||
void MESA_handle_runtime_log_destruction();
|
void MESA_handle_runtime_log_destruction();
|
||||||
|
|
||||||
#define MESA_HANDLE_RUNTIME_LOG(handle, lv, mod, fmt, args...) \
|
#define MESA_HANDLE_RUNTIME_LOG(handle, level, module, format, ...) \
|
||||||
MESA_handle_runtime_log((handle), (lv), (mod), "file %s, line %d, " fmt, \
|
do \
|
||||||
__FILE__, __LINE__, ##args)
|
{ \
|
||||||
|
if (MESA_handle_runtime_log_level_enabled(handle, level)) \
|
||||||
|
{ \
|
||||||
|
MESA_handle_runtime_log(handle, level, module, "file %s, line %d, " format, \
|
||||||
/*
|
__FILE__, __LINE__, ##__VA_ARGS__); \
|
||||||
#define MESA_HANDLE_RUNTIME_LOG_EXPAND(handle, level, module, fmt, ...) \
|
} \
|
||||||
{ \
|
} while (0)
|
||||||
if (MESA_handle_runtime_log_level_enabled(handle, level)) \
|
|
||||||
{ \
|
|
||||||
MESA_handle_runtime_log(handle, level, module, fmt, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
int MESA_handle_runtime_log_level_enabled(void *handle, const int level);
|
int MESA_handle_runtime_log_level_enabled(void *handle, const int level);
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user