feature: packet I/O suppport dumpfile list mode

This commit is contained in:
luwenpeng
2024-08-19 18:40:49 +08:00
parent 520eb085b8
commit 29cbe532ef
8 changed files with 72 additions and 98 deletions

View File

@@ -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_dir[PATH_MAX] = {0};
snprintf(dumpfile_dir, sizeof(dumpfile_dir), "%s/input/", test->work_dir);
char dumpfile_path[PATH_MAX] = {0};
snprintf(dumpfile_path, sizeof(dumpfile_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_dir = \"%s\"", dumpfile_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_dir = \"/tmp/dumpfile/\"", temp) == 0);
EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "dumpfile_path = \"/tmp/dumpfile/dumpfile.pcap\"", temp) == 0);
const char *stellar_cfg_file = "./conf/stellar.toml";
const char *plugin_cfg_file = "./plugin/spec.toml";