diff options
| author | yangwei <[email protected]> | 2024-07-24 16:25:24 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-07-24 17:03:50 +0800 |
| commit | 50d6bb803bba127d1397aa6d54cfac3f445de5ab (patch) | |
| tree | 9825f83dd94acf371f16877a5b8a00972e51b28f | |
| parent | 4a00ae6dea92e1600a5fb057d4b6d902effac478 (diff) | |
🔧 build(cmake): add UndefinedBehaviorSanitizer
| -rw-r--r-- | CMakeLists.txt | 13 | ||||
| -rw-r--r-- | examples/stellar_plugin/simple_stellar_plugin.c | 14 | ||||
| -rw-r--r-- | src/stellar_on_sapp/stellar_on_sapp_api.c | 7 | ||||
| -rw-r--r-- | src/stellar_on_sapp/stellar_on_sapp_loader.c | 19 | ||||
| -rw-r--r-- | test/plugin_manager/plugin_manager_gtest_main.cpp | 66 | ||||
| -rw-r--r-- | test/plugin_manager/plugin_manager_gtest_mock.h | 8 |
6 files changed, 84 insertions, 43 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a92e73a..db7e0df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ endif() #ASAN option set(ASAN_OPTION "OFF" CACHE STRING " set asan type chosen by the user, using OFF as default") -set_property(CACHE ASAN_OPTION PROPERTY STRINGS OFF ADDRESS THREAD) +set_property(CACHE ASAN_OPTION PROPERTY STRINGS OFF ADDRESS THREAD LEAK UBSAN) message(STATUS "ASAN_OPTION='${ASAN_OPTION}'") if(ASAN_OPTION STREQUAL "ADDRESS") @@ -72,6 +72,17 @@ elseif(ASAN_OPTION STREQUAL "THREAD") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan") add_definitions(-DASAN_ENABLED=1) +elseif(ASAN_OPTION STREQUAL "LEAK") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=leak -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=leak -fno-omit-frame-pointer") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -llsan") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -llsan") + add_definitions(-DASAN_ENABLED=1) +elseif(ASAN_OPTION STREQUAL "UBSAN") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=undefined -fno-sanitize-recover=all") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=undefined -fno-sanitize-recover=all") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lubsan") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lubsan") endif() include_directories(${CMAKE_SOURCE_DIR}) diff --git a/examples/stellar_plugin/simple_stellar_plugin.c b/examples/stellar_plugin/simple_stellar_plugin.c index d5447d7..a743b6a 100644 --- a/examples/stellar_plugin/simple_stellar_plugin.c +++ b/examples/stellar_plugin/simple_stellar_plugin.c @@ -1,3 +1,5 @@ +#pragma GCC diagnostic ignored "-Wunused-parameter" + #include "stellar/stellar.h" #include "stellar/session.h" #include "stellar/utils.h" @@ -8,9 +10,9 @@ #include <stdio.h> #include <string.h> - #include <assert.h> + struct simple_stellar_plugin_env { struct stellar *st; @@ -158,7 +160,7 @@ void simple_plugin_on_packet(struct packet *pkt, unsigned char ip_protocol, voi return; } -void simple_plugin_packet_get_exdata(struct packet *pkt, unsigned char ip_protocol __attribute__((unused)), void *plugin_env) +void simple_plugin_packet_get_exdata(struct packet *pkt, unsigned char ip_protocol , void *plugin_env) { struct simple_stellar_plugin_env *env = (struct simple_stellar_plugin_env *)plugin_env; struct simple_stellar_plugin_env *exdata = (struct simple_stellar_plugin_env *)packet_exdata_get(pkt, env->packet_exdata_idx); @@ -177,7 +179,7 @@ int simple_plugin_on_polling(void *plugin_env) return 0; } -static void simple_plugin_packet_exdata_free(struct packet *pkt __attribute__((unused)), int idx __attribute__((unused)), void *ex_ptr, void *arg) +static void simple_plugin_packet_exdata_free(struct packet *pkt , int idx , void *ex_ptr, void *arg) { struct simple_stellar_plugin_env *env = (struct simple_stellar_plugin_env *)arg; assert(env); @@ -188,7 +190,7 @@ static void simple_plugin_packet_exdata_free(struct packet *pkt __attribute__((u } } -static void simple_plugin_packet_msg_free(struct packet *pkt __attribute__((unused)), void *msg, void *msg_free_arg) +static void simple_plugin_packet_msg_free(struct packet *pkt , void *msg, void *msg_free_arg) { struct simple_stellar_plugin_env *env = (struct simple_stellar_plugin_env *)msg_free_arg; assert(env); @@ -200,7 +202,7 @@ static void simple_plugin_packet_msg_free(struct packet *pkt __attribute__((unus } -static void simple_plugin_on_packet_msg_cb(struct packet *pkt __attribute__((unused)), int topic_id __attribute__((unused)), const void *msg, void *plugin_env) +static void simple_plugin_on_packet_msg_cb(struct packet *pkt , int topic_id , const void *msg, void *plugin_env) { struct simple_stellar_plugin_env *env = (struct simple_stellar_plugin_env *)plugin_env; assert(env); @@ -299,7 +301,7 @@ void simple_session_packet_plugin_exit(void *plugin_env) * simple plugin sub session stat * *******************************/ -static void simple_plugin_sub_session_stat_on_msg(struct session *sess, int topic_id, const void *data, void *plugin_ctx __attribute__((unused)), void *plugin_env) +static void simple_plugin_sub_session_stat_on_msg(struct session *sess, int topic_id, const void *data, void *plugin_ctx , void *plugin_env) { struct simple_stellar_plugin_env *env = (struct simple_stellar_plugin_env *)plugin_env; diff --git a/src/stellar_on_sapp/stellar_on_sapp_api.c b/src/stellar_on_sapp/stellar_on_sapp_api.c index 7459c54..20f87a6 100644 --- a/src/stellar_on_sapp/stellar_on_sapp_api.c +++ b/src/stellar_on_sapp/stellar_on_sapp_api.c @@ -224,15 +224,18 @@ inline int polling_on_sapp(struct stellar *st) * STELLAR INFO INTERFACE WRAPPER ON SAPP *********************************************/ -int stellar_get_worker_thread_num(struct stellar *st __attribute__((unused))) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +int stellar_get_worker_thread_num(struct stellar *st) { return get_thread_count(); } -int stellar_get_current_thread_id(struct stellar *st __attribute__((unused))) +int stellar_get_current_thread_id(struct stellar *st) { return get_current_worker_thread_id(); } +#pragma GCC diagnostic pop /********************************************* * PACKET INFO INTERFACE WRAPPER ON SAPP* diff --git a/src/stellar_on_sapp/stellar_on_sapp_loader.c b/src/stellar_on_sapp/stellar_on_sapp_loader.c index a729e31..1497093 100644 --- a/src/stellar_on_sapp/stellar_on_sapp_loader.c +++ b/src/stellar_on_sapp/stellar_on_sapp_loader.c @@ -1,11 +1,10 @@ +#pragma GCC diagnostic ignored "-Wunused-parameter" + #include "stellar/stellar.h" #include "stellar/session_exdata.h" - #include "stellar_on_sapp.h" - #include <MESA/stream.h> - #define STELLAR_PLUGIN_PATH "./stellar_plugin/spec.toml" #define STELLAR_BRIDEGE_NAME "STELLAR_SESSION" #define STELLAR_EXDATA_NAME "SAPP_STREAMINFO" @@ -35,7 +34,7 @@ static int stream_is_inner_most(struct streaminfo *a_stream) } -static void stellar_on_sapp_bridge_free(const struct streaminfo *stream __attribute__((unused)), int bridge_id __attribute__((unused)), void *data) +static void stellar_on_sapp_bridge_free(const struct streaminfo *stream , int bridge_id , void *data) { session_free_on_sapp((struct session *)data); return; @@ -64,7 +63,7 @@ int STELLAR_DEFER_LOADER_INIT() return 0; } -char stellar_on_sapp_defer_entry(struct streaminfo *pstream,void **pme __attribute__((unused)), int thread_seq __attribute__((unused)),void *a_packet __attribute__((unused))) +char stellar_on_sapp_defer_entry(struct streaminfo *pstream,void **pme , int thread_seq ,void *a_packet ) { if(pstream->pktstate==OP_STATE_PENDING && stream_is_inner_most(pstream)==0) { @@ -84,7 +83,7 @@ void STELLAR_DEFER_LOADER_EXIT(void) } -static int is_ctrl_packet(struct streaminfo *pstream __attribute__((unused)), const void *raw_pkt) +static int is_ctrl_packet(struct streaminfo *pstream , const void *raw_pkt) { int is_ctrl_pkt=0; if(raw_pkt) @@ -94,7 +93,7 @@ static int is_ctrl_packet(struct streaminfo *pstream __attribute__((unused)), co return is_ctrl_pkt; } -static unsigned char loader_transfer_stream_entry(struct streaminfo *pstream, UCHAR state, void **pme __attribute__((unused)), int thread_seq __attribute__((unused)),void *a_packet, enum entry_type type) +static unsigned char loader_transfer_stream_entry(struct streaminfo *pstream, UCHAR state, void **pme , int thread_seq ,void *a_packet, enum entry_type type) { unsigned char entry_ret=APP_STATE_GIVEME; if(state == OP_STATE_PENDING && (stream_is_inner_most(pstream)==0)) @@ -173,19 +172,19 @@ unsigned char stellar_on_sapp_tcp_entry(struct streaminfo *pstream,void **pme, i return loader_transfer_stream_entry(pstream, pstream->opstate, pme, thread_seq, a_packet, ENTRY_TYPE_TCP); } -char stellar_on_sapp_ip4_entry( struct streaminfo *pstream,unsigned char routedir __attribute__((unused)),int thread_seq __attribute__((unused)), void *a_packet) +char stellar_on_sapp_ip4_entry( struct streaminfo *pstream,unsigned char routedir ,int thread_seq , void *a_packet) { if(stream_is_inner_most(pstream)==1)packet_update_on_sapp(g_stellar, pstream, a_packet, IPv4); return APP_STATE_GIVEME; } -char stellar_on_sapp_ip6_entry( struct streaminfo *pstream,unsigned char routedir __attribute__((unused)),int thread_seq __attribute__((unused)), void *a_packet) +char stellar_on_sapp_ip6_entry( struct streaminfo *pstream,unsigned char routedir ,int thread_seq , void *a_packet) { if(stream_is_inner_most(pstream)==1)packet_update_on_sapp(g_stellar, pstream, a_packet, IPv6); return APP_STATE_GIVEME; } -char stellar_on_sapp_polling_entry(struct streaminfo *stream __attribute__((unused)), void **pme __attribute__((unused)), int thread_seq __attribute__((unused)),void *a_packet __attribute__((unused))) +char stellar_on_sapp_polling_entry(struct streaminfo *stream , void **pme , int thread_seq ,void *a_packet ) { int ret = polling_on_sapp(g_stellar); switch (ret) diff --git a/test/plugin_manager/plugin_manager_gtest_main.cpp b/test/plugin_manager/plugin_manager_gtest_main.cpp index 7137690..f074cc8 100644 --- a/test/plugin_manager/plugin_manager_gtest_main.cpp +++ b/test/plugin_manager/plugin_manager_gtest_main.cpp @@ -1,5 +1,6 @@ -#include <gtest/gtest.h> +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include <gtest/gtest.h> #include "stellar/utils.h" #include "plugin_manager_gtest_mock.h" @@ -87,9 +88,9 @@ TEST(plugin_manager_init, init_with_null_toml) { * TEST PLUGIN MANAGER PACKET PLUGIN INIT * ******************************************/ -static void test_mock_packet_exdata_free(struct packet *pkt __attribute__((unused)), int idx __attribute__((unused)), void *ex_ptr __attribute__((unused)), void *arg __attribute__((unused))){} +static void test_mock_packet_exdata_free(struct packet *pkt , int idx , void *ex_ptr , void *arg ){} -static void test_mock_overwrite_packet_exdata_free(struct packet *pkt __attribute__((unused)), int idx __attribute__((unused)), void *ex_ptr __attribute__((unused)), void *arg __attribute__((unused))){} +static void test_mock_overwrite_packet_exdata_free(struct packet *pkt , int idx , void *ex_ptr , void *arg ){} TEST(plugin_manager_init, packet_exdata_new_index_overwrite) { struct stellar st={0}; @@ -119,8 +120,8 @@ TEST(plugin_manager_init, packet_exdata_new_index_overwrite) { plugin_manager_exit(plug_mgr); } -void test_mock_packet_msg_free(struct packet *pkt __attribute__((unused)), void *msg __attribute__((unused)), void *msg_free_arg __attribute__((unused))){} -void test_mock_overwrite_packet_msg_free(struct packet *pkt __attribute__((unused)), void *msg __attribute__((unused)), void *msg_free_arg __attribute__((unused))){} +void test_mock_packet_msg_free(struct packet *pkt , void *msg , void *msg_free_arg ){} +void test_mock_overwrite_packet_msg_free(struct packet *pkt , void *msg , void *msg_free_arg ){} TEST(plugin_manager_init, packet_mq_topic_create_and_update) { struct stellar st={0}; @@ -183,9 +184,9 @@ TEST(plugin_manager_init, packet_mq_topic_create_and_update) { plugin_manager_exit(plug_mgr); } -void test_mock_on_packet_msg(struct packet *pkt __attribute__((unused)), int topic_id __attribute__((unused)), const void *msg __attribute__((unused)), void *plugin_env __attribute__((unused))){} +void test_mock_on_packet_msg(struct packet *pkt , int topic_id , const void *msg , void *plugin_env ){} -void test_mock_overwrite_on_packet_msg(struct packet *pkt __attribute__((unused)), int topic_id __attribute__((unused)), const void *msg __attribute__((unused)), void *plugin_env __attribute__((unused))){} +void test_mock_overwrite_on_packet_msg(struct packet *pkt , int topic_id , const void *msg , void *plugin_env ){} TEST(plugin_manager_init, packet_mq_subscribe) { @@ -765,8 +766,8 @@ TEST(plugin_manager, packet_plugin_exdata_free_pub_msg) { * TEST PLUGIN MANAGER ON SESSION PLUGIN INIT * **********************************************/ -static void test_mock_session_exdata_free(struct session *sess __attribute__((unused)), int idx __attribute__((unused)), void *ex_ptr __attribute__((unused)), void *arg __attribute__((unused))){} -static void test_mock_overwrite_session_exdata_free(struct session *sess __attribute__((unused)), int idx __attribute__((unused)), void *ex_ptr __attribute__((unused)), void *arg __attribute__((unused))){} +static void test_mock_session_exdata_free(struct session *sess , int idx , void *ex_ptr , void *arg ){} +static void test_mock_overwrite_session_exdata_free(struct session *sess , int idx , void *ex_ptr , void *arg ){} TEST(plugin_manager_init, session_exdata_new_index_overwrite) { struct stellar st={0}; @@ -795,8 +796,8 @@ TEST(plugin_manager_init, session_exdata_new_index_overwrite) { plugin_manager_exit(plug_mgr); } -void test_mock_session_msg_free(struct session *sess __attribute__((unused)), void *msg __attribute__((unused)), void *msg_free_arg __attribute__((unused))){} -void test_mock_overwrite_session_msg_free(struct session *sess __attribute__((unused)), void *msg __attribute__((unused)), void *msg_free_arg __attribute__((unused))){} +void test_mock_session_msg_free(struct session *sess , void *msg , void *msg_free_arg ){} +void test_mock_overwrite_session_msg_free(struct session *sess , void *msg , void *msg_free_arg ){} TEST(plugin_manager_init, session_mq_topic_create_and_update) { struct stellar st={0}; @@ -861,8 +862,8 @@ TEST(plugin_manager_init, session_mq_topic_create_and_update) { plugin_manager_exit(plug_mgr); } -void test_mock_on_session_msg(struct session *sess __attribute__((unused)), int topic_id __attribute__((unused)), const void *msg __attribute__((unused)), void *per_session_ctx __attribute__((unused)), void *plugin_env __attribute__((unused))){} -void test_mock_overwrite_on_session_msg(struct session *sess __attribute__((unused)), int topic_id __attribute__((unused)), const void *msg __attribute__((unused)), void *per_session_ctx __attribute__((unused)), void *plugin_env __attribute__((unused))){} +void test_mock_on_session_msg(struct session *sess , int topic_id , const void *msg , void *per_session_ctx , void *plugin_env ){} +void test_mock_overwrite_on_session_msg(struct session *sess , int topic_id , const void *msg , void *per_session_ctx , void *plugin_env ){} TEST(plugin_manager_init, session_mq_subscribe_overwrite) { @@ -954,7 +955,10 @@ TEST(plugin_manager, no_plugin_register_runtime) { // pesudo running stage for(int i=0; i < env.N_session; i++) + { sess[i].plug_mgr_rt=plugin_manager_session_runtime_new(plug_mgr, &sess[i]); + sess[i].type=SESSION_TYPE_TCP; + } for (int j = 0; j < env.N_per_session_pkt_cnt; j++) { @@ -1087,7 +1091,10 @@ TEST(plugin_manager, session_plugin_on_intrinsic_ingress_egress) { struct session sess[env.N_session]; for(int i=0; i < env.N_session; i++) + { sess[i].plug_mgr_rt=plugin_manager_session_runtime_new(plug_mgr, &sess[i]); + sess[i].type=SESSION_TYPE_TCP; + } for (int j = 0; j < env.N_per_session_pkt_cnt; j++) { @@ -1236,7 +1243,10 @@ TEST(plugin_manager, session_plugin_ignore_on_ctx_new_sub_other_msg) { struct session sess[env.N_session]; for(int i=0; i < env.N_session; i++) + { sess[i].plug_mgr_rt=plugin_manager_session_runtime_new(plug_mgr, &sess[i]); + sess[i].type=SESSION_TYPE_TCP; + } for (int j = 0; j < env.N_per_session_pkt_cnt; j++) { @@ -1400,7 +1410,10 @@ TEST(plugin_manager, session_plugin_pub_msg_overlimt) { struct session sess[env.N_session]; for(int i=0; i < env.N_session; i++) + { sess[i].plug_mgr_rt=plugin_manager_session_runtime_new(plug_mgr, &sess[i]); + sess[i].type=SESSION_TYPE_TCP; + } for (int j = 0; j < env.N_per_session_pkt_cnt; j++) { @@ -1467,7 +1480,7 @@ static void test_dettach_session_ctx_free(struct session *sess, void *session_ct FREE(ctx); } -static void test_dettach_on_session(struct session *sess, int topic_id, const void *msg __attribute__((unused)), void *per_session_ctx, void *plugin_env) +static void test_dettach_on_session(struct session *sess, int topic_id, const void *msg , void *per_session_ctx, void *plugin_env) { EXPECT_TRUE(sess!=NULL); struct test_basic_ctx *ctx=(struct test_basic_ctx *)per_session_ctx; @@ -1511,7 +1524,10 @@ TEST(plugin_manager, session_plugin_on_ctx_new_then_dettach) { memset(&sess, 0, sizeof(sess)); for(int i=0; i < env.N_session; i++) + { sess[i].plug_mgr_rt=plugin_manager_session_runtime_new(plug_mgr, &sess[i]); + sess[i].type=SESSION_TYPE_TCP; + } for (int j = 0; j < env.N_per_session_pkt_cnt; j++) { @@ -1561,7 +1577,7 @@ static void test_invalid_pub_msg_session_ctx_free(struct session *sess, void *se FREE(ctx); } -static void test_invalid_pub_msg_on_session(struct session *sess, int topic_id, const void *msg __attribute__((unused)), void *per_session_ctx, void *plugin_env) +static void test_invalid_pub_msg_on_session(struct session *sess, int topic_id, const void *msg , void *per_session_ctx, void *plugin_env) { struct session_plugin_env *env = (struct session_plugin_env *)plugin_env; EXPECT_TRUE(sess!=NULL); @@ -1605,7 +1621,10 @@ TEST(plugin_manager, session_plugin_pub_on_ctx_free) { // pesudo running stage for(int i=0; i < env.N_session; i++) + { sess[i].plug_mgr_rt=plugin_manager_session_runtime_new(plug_mgr, &sess[i]); + sess[i].type=SESSION_TYPE_TCP; + } for (int j = 0; j < env.N_per_session_pkt_cnt; j++) { @@ -1765,19 +1784,19 @@ struct test_session_called_ctx int called; }; -static void *test_session_called_ctx_new(struct session *sess __attribute__((unused)), void *plugin_env __attribute__((unused))) +static void *test_session_called_ctx_new(struct session *sess , void *plugin_env ) { struct test_session_called_ctx *ctx=CALLOC(struct test_session_called_ctx, 1); return ctx; } -static void test_session_called_ctx_free(struct session *sess __attribute__((unused)) , void *session_ctx, void *plugin_env __attribute__((unused))) +static void test_session_called_ctx_free(struct session *sess , void *session_ctx, void *plugin_env ) { FREE(session_ctx); } //test session topic is active -static void test_session_mq_topic_is_active_plugin_1_on_msg(struct session *sess, int topic_id, const void *msg __attribute__((unused)), void *per_session_ctx, void *plugin_env) +static void test_session_mq_topic_is_active_plugin_1_on_msg(struct session *sess, int topic_id, const void *msg , void *per_session_ctx, void *plugin_env) { struct session_plugin_env *env = (struct session_plugin_env *)plugin_env; struct test_session_called_ctx *ctx=(struct test_session_called_ctx *)per_session_ctx; @@ -1791,7 +1810,7 @@ static void test_session_mq_topic_is_active_plugin_1_on_msg(struct session *sess return; } -static void test_session_mq_topic_is_active_plugin_2_on_msg(struct session *sess, int topic_id, const void *msg __attribute__((unused)), void *per_session_ctx, void *plugin_env) +static void test_session_mq_topic_is_active_plugin_2_on_msg(struct session *sess, int topic_id, const void *msg , void *per_session_ctx, void *plugin_env) { struct session_plugin_env *env = (struct session_plugin_env *)plugin_env; struct test_session_called_ctx *ctx=(struct test_session_called_ctx *)per_session_ctx; @@ -1884,7 +1903,7 @@ TEST(plugin_manager, test_session_mq_topic_is_active) { } //test dettach session -static void test_session_dettach_plugin_1_on_msg(struct session *sess, int topic_id, const void *msg __attribute__((unused)), void *per_session_ctx, void *plugin_env) +static void test_session_dettach_plugin_1_on_msg(struct session *sess, int topic_id, const void *msg , void *per_session_ctx, void *plugin_env) { struct session_plugin_env *env = (struct session_plugin_env *)plugin_env; struct test_session_called_ctx *ctx=(struct test_session_called_ctx *)per_session_ctx; @@ -1897,7 +1916,7 @@ static void test_session_dettach_plugin_1_on_msg(struct session *sess, int topic return; } -static void test_session_dettach_plugin_2_on_msg(struct session *sess, int topic_id, const void *msg __attribute__((unused)), void *per_session_ctx, void *plugin_env) +static void test_session_dettach_plugin_2_on_msg(struct session *sess, int topic_id, const void *msg , void *per_session_ctx, void *plugin_env) { struct session_plugin_env *env = (struct session_plugin_env *)plugin_env; struct test_session_called_ctx *ctx=(struct test_session_called_ctx *)per_session_ctx; @@ -2182,7 +2201,10 @@ TEST(plugin_manager, session_exdata_free_pub_msg) { // pesudo running stage for(int i=0; i < env.N_session; i++) + { sess[i].plug_mgr_rt=plugin_manager_session_runtime_new(plug_mgr, &sess[i]); + sess[i].type=SESSION_TYPE_TCP; + } for (int j = 0; j < env.N_per_session_pkt_cnt; j++) { @@ -2216,7 +2238,7 @@ TEST(plugin_manager, session_exdata_free_pub_msg) { * TEST PLUGIN MANAGER ON POLLING PLUGIN INIT * **********************************************/ -int test_plugin_on_polling_func(void *plugin_env __attribute__((unused))) +int test_plugin_on_polling_func(void *plugin_env ) { return 1; } diff --git a/test/plugin_manager/plugin_manager_gtest_mock.h b/test/plugin_manager/plugin_manager_gtest_mock.h index 3d14307..9a55cb2 100644 --- a/test/plugin_manager/plugin_manager_gtest_mock.h +++ b/test/plugin_manager/plugin_manager_gtest_mock.h @@ -51,15 +51,19 @@ int stellar_plugin_manager_schema_set(struct stellar *st, struct plugin_manager_ return 0; } -int stellar_get_worker_thread_num(struct stellar *st __attribute__((unused))) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" + +int stellar_get_worker_thread_num(struct stellar *st) { return 16; } -int stellar_get_current_thread_id(struct stellar *st __attribute__((unused))) +int stellar_get_current_thread_id(struct stellar *st) { return 0; } +#pragma GCC diagnostic pop struct stellar * packet_stellar_get(struct packet *pkt) { |
