diff options
| author | luwenpeng <[email protected]> | 2024-08-30 10:21:44 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2024-08-30 18:56:35 +0800 |
| commit | d1d5e6e09e92361f16586f2f611351c45b2b932b (patch) | |
| tree | a49dffe75f62cb8b1f5fde0fd734e77ce76554fb /test | |
| parent | 8935e5408b58885773e7db04403c2ae3fca590c7 (diff) | |
refactor packet IO, rename dumpfile mode to pcap mode, modify related configuration
Diffstat (limited to 'test')
| -rw-r--r-- | test/decoders/http/test_based_on_stellar/env/stellar.toml | 12 | ||||
| -rw-r--r-- | test/lpi_plugin/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | test/packet_inject/conf/stellar.toml | 12 | ||||
| -rw-r--r-- | test/packet_inject/packet_inject_test.h | 10 |
4 files changed, 15 insertions, 23 deletions
diff --git a/test/decoders/http/test_based_on_stellar/env/stellar.toml b/test/decoders/http/test_based_on_stellar/env/stellar.toml index 210ce3d..b472a69 100644 --- a/test/decoders/http/test_based_on_stellar/env/stellar.toml +++ b/test/decoders/http/test_based_on_stellar/env/stellar.toml @@ -3,15 +3,13 @@ snowflake_base = 1 # [0, 31] snowflake_offset = 2 # [0, 127] [packet_io] -mode = "dumpfile" # dumpfile, dumpfilelist, marsio +mode = "pcapfile" # pcapfile, pcaplist, marsio app_symbol = "stellar" dev_symbol = "nf_0_fw" - -dumpfile_path = "./pcap/test.pcap" -#dumpfile_path = "/tmp/dumpfile/dumpfilelist" - -nr_worker_thread = 1 # [1, 256] +pcap_path = "./pcap/test.pcap" +nr_worker_thread = 1 # range: [1, 256] cpu_mask = [5, 6, 7, 8, 9, 10, 11, 12] +idle_yield_interval_ms = 900 # range: [0, 60000] (ms) [ip_reassembly] enable = 1 @@ -67,5 +65,3 @@ tcp_reassembly_max_segments = 256 # range: [2, 4096] [schedule] merge_stat_interval = 50 # range: [1, 60000] (ms) output_stat_interval = 10 # range: [1, 60000] (ms) - -packet_io_yield_interval = 90 # range: [1, 60000] (ms) diff --git a/test/lpi_plugin/CMakeLists.txt b/test/lpi_plugin/CMakeLists.txt index 116ad8f..813451f 100644 --- a/test/lpi_plugin/CMakeLists.txt +++ b/test/lpi_plugin/CMakeLists.txt @@ -23,8 +23,8 @@ add_test(NAME ${TEST_NAME}.SETUP COMMAND sh -c " cp ${CMAKE_CURRENT_SOURCE_DIR}/test_config/spec.toml ${CMAKE_CURRENT_BINARY_DIR}/plugin/ && cp ${CMAKE_SOURCE_DIR}/conf/log.toml ${CMAKE_CURRENT_BINARY_DIR}/conf/ && cp ${CMAKE_CURRENT_SOURCE_DIR}/test_config/tsg_l7_protocol.conf ${CMAKE_CURRENT_BINARY_DIR}/tsgconf/ && - tomlq -t -i '.packet_io.dumpfile_path=\"-\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml && - tomlq -t -i '.packet_io.mode=\"dumpfilelist\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml + tomlq -t -i '.packet_io.pcap_path=\"-\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml && + tomlq -t -i '.packet_io.mode=\"pcaplist\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml ") diff --git a/test/packet_inject/conf/stellar.toml b/test/packet_inject/conf/stellar.toml index d039d0d..4791358 100644 --- a/test/packet_inject/conf/stellar.toml +++ b/test/packet_inject/conf/stellar.toml @@ -3,15 +3,13 @@ snowflake_base = 1 # [0, 31] snowflake_offset = 2 # [0, 127] [packet_io] -mode = "dumpfile" # dumpfile, dumpfilelist, marsio +mode = "pcapfile" # pcapfile, pcaplist, marsio app_symbol = "stellar" dev_symbol = "nf_0_fw" - -dumpfile_path = "/tmp/dumpfile/dumpfile.pcap" -#dumpfile_path = "/tmp/dumpfile/dumpfilelist" - -nr_worker_thread = 1 # [1, 256] +pcap_path = "/tmp/test.pcap" +nr_worker_thread = 1 # range: [1, 256] cpu_mask = [5] +idle_yield_interval_ms = 900 # range: [0, 60000] (ms) [ip_reassembly] enable = 1 @@ -67,5 +65,3 @@ tcp_reassembly_max_segments = 128 # range: [2, 4096] [schedule] merge_stat_interval = 50 # range: [1, 60000] (ms) output_stat_interval = 2000 # range: [1, 60000] (ms) - -packet_io_yield_interval = 900 # range: [1, 60000] (ms) diff --git a/test/packet_inject/packet_inject_test.h b/test/packet_inject/packet_inject_test.h index 3728840..dc8bf79 100644 --- a/test/packet_inject/packet_inject_test.h +++ b/test/packet_inject/packet_inject_test.h @@ -145,8 +145,8 @@ static inline void expect_cmp_inject(const char *expect_pcap_file, const char *i static inline void packet_inject_test(struct packet_inject_case *test) { // create directory - char dumpfile_path[PATH_MAX] = {0}; - snprintf(dumpfile_path, sizeof(dumpfile_path), "%s/input/%s", test->work_dir, test->input_pcap); + char pcap_path[PATH_MAX] = {0}; + snprintf(pcap_path, sizeof(pcap_path), "%s/input/%s", test->work_dir, test->input_pcap); system_cmd("rm -rf %s", test->work_dir); system_cmd("mkdir -p %s/input/", test->work_dir); system_cmd("mkdir -p %s/log/", test->work_dir); @@ -173,9 +173,9 @@ static inline void packet_inject_test(struct packet_inject_case *test) char temp[PATH_MAX * 2] = {0}; getcwd(cwd, sizeof(cwd)); chdir(test->work_dir); - snprintf(temp, sizeof(temp), "dumpfile_path = \"%s\"", dumpfile_path); - EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "mode = marsio", "mode = dumpfile") == 0); - EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "dumpfile_path = \"/tmp/dumpfile/dumpfile.pcap\"", temp) == 0); + snprintf(temp, sizeof(temp), "pcap_path = \"%s\"", pcap_path); + EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "mode = marsio", "mode = pcapfile") == 0); + EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "pcap_path = \"/tmp/test.pcap\"", temp) == 0); const char *stellar_cfg_file = "./conf/stellar.toml"; const char *plugin_cfg_file = "./plugin/spec.toml"; |
