From db737f145d661cfeac30618a47ff2643b1949219 Mon Sep 17 00:00:00 2001 From: Stefan Saroiu Date: Tue, 20 Aug 2024 04:20:09 +0000 Subject: [PATCH 1/2] Added dummy first argument to all CmdLineOpts --- src/core/drivers/dpdk/dpdk_test.cc | 4 +++- src/core/flow_test.cc | 5 +++-- src/core/machnet_engine_test.cc | 4 +++- src/include/dpdk.h | 4 +++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/core/drivers/dpdk/dpdk_test.cc b/src/core/drivers/dpdk/dpdk_test.cc index a9036608..9d201ae6 100644 --- a/src/core/drivers/dpdk/dpdk_test.cc +++ b/src/core/drivers/dpdk/dpdk_test.cc @@ -63,8 +63,10 @@ TEST(BasicTxTest, BasicTxTest) { int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); + // CmdLineOpts are eventually parsed by DPDK using getopt. getopt ignores argv[0]. + // So, we need to pass an empty string as the first argument. auto kEalOpts = juggler::utils::CmdLineOpts( - {"-c", "0x0", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", + {"", "-c", "0x1", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", "8", "--vdev=net_null0,copy=1", "--no-pci"}); auto d = juggler::dpdk::Dpdk(); diff --git a/src/core/flow_test.cc b/src/core/flow_test.cc index c45533cd..d7a0f724 100644 --- a/src/core/flow_test.cc +++ b/src/core/flow_test.cc @@ -512,9 +512,10 @@ int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); FLAGS_logtostderr = 1; - // Initialize DPDK + // CmdLineOpts are eventually parsed by DPDK using getopt. getopt ignores argv[0]. + // So, we need to pass an empty string as the first argument. auto kEalOpts = juggler::utils::CmdLineOpts( - {"-c", "0x0", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", + {"", "-c", "0x1", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", "8", "--vdev=net_null0,copy=1", "--no-pci"}); auto d = juggler::dpdk::Dpdk(); d.InitDpdk(kEalOpts); /* Using default DPDK configurations */ diff --git a/src/core/machnet_engine_test.cc b/src/core/machnet_engine_test.cc index 0239c10d..c8a6062a 100644 --- a/src/core/machnet_engine_test.cc +++ b/src/core/machnet_engine_test.cc @@ -113,8 +113,10 @@ TEST(BasicMachnetEngineTest, BasicMachnetEngineTest) { int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); + // CmdLineOpts are eventually parsed by DPDK using getopt. getopt ignores argv[0]. + // So, we need to pass an empty string as the first argument. auto kEalOpts = juggler::utils::CmdLineOpts( - {"-c", "0x0", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", + {"", "-c", "0x1", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", "8", "--vdev=net_null0,copy=1", "--no-pci"}); auto d = juggler::dpdk::Dpdk(); diff --git a/src/include/dpdk.h b/src/include/dpdk.h index c09b6e19..8cdd8a96 100644 --- a/src/include/dpdk.h +++ b/src/include/dpdk.h @@ -87,8 +87,10 @@ namespace dpdk { } // Default EAL init arguments. +// CmdLineOpts are eventually parsed by DPDK using getopt. getopt ignores argv[0]. +// So, we need to pass an empty string as the first argument. static auto kDefaultEalOpts = - juggler::utils::CmdLineOpts({"--log-level=eal,8", "--proc-type=auto"}); + juggler::utils::CmdLineOpts({"", "--log-level=eal,8", "--proc-type=auto"}); class Dpdk { public: From 8bcf4c6751494f1a720aadcf92803603e60c5570 Mon Sep 17 00:00:00 2001 From: Anuj Kalia Date: Tue, 20 Aug 2024 19:40:11 -0700 Subject: [PATCH 2/2] some fixes --- src/core/drivers/dpdk/dpdk_test.cc | 4 +--- src/core/flow_test.cc | 5 ++--- src/core/machnet_engine_test.cc | 4 +--- src/include/dpdk.h | 2 -- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/core/drivers/dpdk/dpdk_test.cc b/src/core/drivers/dpdk/dpdk_test.cc index 9d201ae6..0751e002 100644 --- a/src/core/drivers/dpdk/dpdk_test.cc +++ b/src/core/drivers/dpdk/dpdk_test.cc @@ -63,10 +63,8 @@ TEST(BasicTxTest, BasicTxTest) { int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); - // CmdLineOpts are eventually parsed by DPDK using getopt. getopt ignores argv[0]. - // So, we need to pass an empty string as the first argument. auto kEalOpts = juggler::utils::CmdLineOpts( - {"", "-c", "0x1", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", + {"", "-c", "0x0", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", "8", "--vdev=net_null0,copy=1", "--no-pci"}); auto d = juggler::dpdk::Dpdk(); diff --git a/src/core/flow_test.cc b/src/core/flow_test.cc index d7a0f724..f2b2cfad 100644 --- a/src/core/flow_test.cc +++ b/src/core/flow_test.cc @@ -512,10 +512,9 @@ int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); FLAGS_logtostderr = 1; - // CmdLineOpts are eventually parsed by DPDK using getopt. getopt ignores argv[0]. - // So, we need to pass an empty string as the first argument. + // Initialize DPDK auto kEalOpts = juggler::utils::CmdLineOpts( - {"", "-c", "0x1", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", + {"", "-c", "0x0", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", "8", "--vdev=net_null0,copy=1", "--no-pci"}); auto d = juggler::dpdk::Dpdk(); d.InitDpdk(kEalOpts); /* Using default DPDK configurations */ diff --git a/src/core/machnet_engine_test.cc b/src/core/machnet_engine_test.cc index c8a6062a..4b6697d1 100644 --- a/src/core/machnet_engine_test.cc +++ b/src/core/machnet_engine_test.cc @@ -113,10 +113,8 @@ TEST(BasicMachnetEngineTest, BasicMachnetEngineTest) { int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); - // CmdLineOpts are eventually parsed by DPDK using getopt. getopt ignores argv[0]. - // So, we need to pass an empty string as the first argument. auto kEalOpts = juggler::utils::CmdLineOpts( - {"", "-c", "0x1", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", + {"", "-c", "0x0", "-n", "6", "--proc-type=auto", "-m", "1024", "--log-level", "8", "--vdev=net_null0,copy=1", "--no-pci"}); auto d = juggler::dpdk::Dpdk(); diff --git a/src/include/dpdk.h b/src/include/dpdk.h index 8cdd8a96..aadb58ba 100644 --- a/src/include/dpdk.h +++ b/src/include/dpdk.h @@ -87,8 +87,6 @@ namespace dpdk { } // Default EAL init arguments. -// CmdLineOpts are eventually parsed by DPDK using getopt. getopt ignores argv[0]. -// So, we need to pass an empty string as the first argument. static auto kDefaultEalOpts = juggler::utils::CmdLineOpts({"", "--log-level=eal,8", "--proc-type=auto"});