🐎 ci(test): 增加test stage

This commit is contained in:
yangwei
2023-05-31 13:57:17 +08:00
parent 67ed711088
commit 7ed1582309
3 changed files with 56 additions and 20 deletions

View File

@@ -106,6 +106,7 @@ int main(int argc, char ** args)
{
pthread_t t[MAX_THREAD_NUM];
int i = 0;
int ret =0;
if (argc != 6)
{
@@ -136,26 +137,35 @@ int main(int argc, char ** args)
{
printf("get log sample_handle error\n");
return -1;
}
}
test_handle = MESA_create_runtime_log_handle("./log/test_log", RLOG_LV_DEBUG);
if(test_handle == NULL)
{
printf("get log test_handle error\n");
return -1;
}
test_handle = MESA_create_runtime_log_handle("./log/test_log", RLOG_LV_DEBUG);
if (test_handle == NULL)
{
printf("get log test_handle error\n");
return -1;
}
for(i = 0; i < g_thread_num; i++)
{
pthread_create(&t[i], NULL, thread_logger, (void *)(unsigned long)(i));
}
signal(SIGINT, sig_int_handler);
signal(SIGHUP, sig_hup_handler);
while(1)
;
//MESA_destroy_runtime_log_handle(sample_handle);
//MESA_destroy_runtime_log_handle(test_handle);
//sample_handle = NULL;
//test_handle = NULL;
return 0;
for (i = 0; i < g_thread_num; i++)
{
pthread_create(&t[i], NULL, thread_logger, (void *)(unsigned long)(i));
}
signal(SIGINT, sig_int_handler);
signal(SIGHUP, sig_hup_handler);
// 等待所有线程结束并回收
for (i = 0; i < g_thread_num; ++i) {
ret = pthread_join(t[i], NULL);
if (ret != 0) {
fprintf(stderr, "Failed to join thread %d\n", i);
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;
}