diff options
| author | 李佳 <[email protected]> | 2024-04-11 11:44:16 +0000 |
|---|---|---|
| committer | 李佳 <[email protected]> | 2024-04-11 11:44:16 +0000 |
| commit | 94ed075dda28fc975d9061f20de0dc594a35653c (patch) | |
| tree | 5d397a7adf6d46be96dd4a50c25318f052ad53d4 /test | |
| parent | 8be661adc385b843ca36769f71d43549848e4c7d (diff) | |
Test case based on stellar
Diffstat (limited to 'test')
| -rw-r--r-- | test/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | test/http_decoder_gtest.cpp | 7 | ||||
| -rw-r--r-- | test/test_env/conflist.inf | 9 | ||||
| -rw-r--r-- | test/test_env/sapp4.el8.x86_64.rpm | bin | 1052968 -> 0 bytes | |||
| -rw-r--r-- | test/test_env/spec.toml | 11 | ||||
| -rw-r--r-- | test/test_env/start_loader.inf | 17 | ||||
| -rw-r--r-- | test/test_env/tsg_l7_protocol.conf | 57 |
7 files changed, 10 insertions, 98 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e7aa83e..7388239 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,15 +1,16 @@ set(DECODER_NAME http_decoder) -add_library(${DECODER_NAME}_test SHARED http_decoder_gtest.cpp) +add_library(${DECODER_NAME}_test SHARED http_decoder_gtest.cpp md5.c) add_dependencies(${DECODER_NAME}_test ${DECODER_NAME}) -target_link_libraries(${DECODER_NAME}_test MESA_prof_load) -set_target_properties(${DECODER_NAME}_test PROPERTIES PREFIX "") +target_link_libraries(${DECODER_NAME}_test MESA_prof_load cjson-static) +set_target_properties(${DECODER_NAME}_test PROPERTIES PREFIX "") set(TEST_RUN_DIR ${CMAKE_BINARY_DIR}/testing) include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(/usr/local/include/cjson) include_directories(/opt/tsg/framework/include/stellar) +include_directories(/opt/tsg/framework/include/) include_directories(/opt/MESA/include/MESA) add_executable(gtest_http_decoder http_decoder_driver.cpp http_decoder_stub.cpp http_decoder_gtest.cpp md5.c base64.c) diff --git a/test/http_decoder_gtest.cpp b/test/http_decoder_gtest.cpp index 4f21955..cabba75 100644 --- a/test/http_decoder_gtest.cpp +++ b/test/http_decoder_gtest.cpp @@ -268,9 +268,14 @@ static void http_decoder_test_update_session_tuple4(struct session *sess, struct { if (gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION] == NULL) { + const char *human_addr_cstr = session_get0_readable_addr(sess); + if(NULL == human_addr_cstr){ + fprintf(stderr, "can't get readable_addr, to use session_get0_readable_addr() the sapp_log.conf level must <= INFO\n"); + return; + } char result_name[MAX_KEY_STR_LEN] = {0}; gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION] = cJSON_CreateObject(); - cJSON_AddStringToObject(gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION], GTEST_HTTP_TUPLE4_NAME, session_get0_readable_addr(sess)); + cJSON_AddStringToObject(gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION], GTEST_HTTP_TUPLE4_NAME, human_addr_cstr); sprintf(result_name, "%d", g_result_count++); commit_test_result_json(gtest_plug_exdata->result_jnode[HTTP_TRANSACTION_SESSION], result_name); } diff --git a/test/test_env/conflist.inf b/test/test_env/conflist.inf deleted file mode 100644 index 2e8144d..0000000 --- a/test/test_env/conflist.inf +++ /dev/null @@ -1,9 +0,0 @@ -[platform] -./plug/stellar_on_sapp/start_loader.inf - - -[protocol] - - -[business] -#./plug/stellar_on_sapp/defer_loader.inf diff --git a/test/test_env/sapp4.el8.x86_64.rpm b/test/test_env/sapp4.el8.x86_64.rpm Binary files differdeleted file mode 100644 index e43fe2f..0000000 --- a/test/test_env/sapp4.el8.x86_64.rpm +++ /dev/null diff --git a/test/test_env/spec.toml b/test/test_env/spec.toml deleted file mode 100644 index b8c7eb9..0000000 --- a/test/test_env/spec.toml +++ /dev/null @@ -1,11 +0,0 @@ -# stellar_plugin.toml -# -[[plugin]] -path = "./stellar_plugin/http_decoder.so" -init = "http_decoder_init" -exit = "http_decoder_exit" - -[[plugin]] -path = "./stellar_plugin/http_decoder_test.so" -init = "http_decoder_test_init" -exit = "http_decoder_test_exit"
\ No newline at end of file diff --git a/test/test_env/start_loader.inf b/test/test_env/start_loader.inf deleted file mode 100644 index 89b2f94..0000000 --- a/test/test_env/start_loader.inf +++ /dev/null @@ -1,17 +0,0 @@ -[PLUGINFO] -PLUGNAME=stellar_start_loader -SO_PATH=./plug/stellar_on_sapp/stellar_on_sapp.so -INIT_FUNC=STELLAR_START_LOADER_INIT -DESTROY_FUNC=STELLAR_START_LOADER_EXIT - -#[TCP_ALL] -#FUNC_FLAG=ALL -#FUNC_NAME=stellar_on_sapp_tcpall_entry - -[TCP] -FUNC_FLAG=ALL -FUNC_NAME=stellar_on_sapp_tcp_entry - -[UDP] -FUNC_FLAG=ALL -FUNC_NAME=stellar_on_sapp_udp_entry
\ No newline at end of file diff --git a/test/test_env/tsg_l7_protocol.conf b/test/test_env/tsg_l7_protocol.conf deleted file mode 100644 index 1075a8f..0000000 --- a/test/test_env/tsg_l7_protocol.conf +++ /dev/null @@ -1,57 +0,0 @@ -#TYPE:1:UCHAR,2:USHORT,3:USTRING,4:ULOG,5:USTRING,6:FILE,7:UBASE64,8:PACKET -#TYPE FIELD VALUE -STRING UNCATEGORIZED 8000 -#STRING UNCATEGORIZED 8001 -#STRING UNKNOWN_OTHER 8002 -STRING DNS 32 -STRING FTP 45 -STRING FTPS 751 -STRING HTTP 67 -STRING HTTPS 68 -STRING ICMP 70 -STRING IKE 8003 -STRING MAIL 8004 -STRING IMAP 75 -STRING IMAPS 76 -STRING IPSEC 85 -STRING XMPP 94 -STRING L2TP 98 -STRING NTP 137 -STRING POP3 147 -STRING POP3S 148 -STRING PPTP 153 -STRING QUIC 2521 -STRING SIP 182 -STRING SMB 185 -STRING SMTP 186 -STRING SMTPS 187 -STRING SPDY 1469 -STRING SSH 198 -STRING SSL 199 -STRING SOCKS 8005 -STRING TELNET 209 -STRING DHCP 29 -STRING RADIUS 158 -STRING OPENVPN 336 -STRING STUN 201 -STRING TEREDO 555 -STRING DTLS 1291 -STRING DoH 8006 -STRING ISAKMP 92 -STRING MDNS 3835 -STRING NETBIOS 129 -STRING NETFLOW 130 -STRING RDP 150 -STRING RTCP 174 -STRING RTP 175 -STRING SLP 8007 -STRING SNMP 190 -STRING SSDP 197 -STRING TFTP 211 -STRING BJNP 2481 -STRING LDAP 100 -STRING RTMP 337 -STRING RTSP 176 -STRING ESNI 8008 -STRING QQ 156 -STRING WeChat 1296 |
