diff options
Diffstat (limited to 'test/gtest/main.cpp')
-rw-r--r-- | test/gtest/main.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/test/gtest/main.cpp b/test/gtest/main.cpp index 8c4e2dc..17cdccd 100644 --- a/test/gtest/main.cpp +++ b/test/gtest/main.cpp @@ -13,17 +13,30 @@ * limitations under the License. */ +#include <iostream> #include <gtest/gtest.h> #include <gmock/gmock.h> -#include <iostream> + #include <rte_common.h> #include <rte_eal.h> +#include <rte_ethdev.h> +#include <rte_cycles.h> +#include <rte_lcore.h> +#include <rte_mbuf.h> +#include <rte_errno.h> + +#include "test_common.h" -int main(int argc, char *argv[]) +struct rte_mempool *mbuf_pool; + +int +main(int argc, char *argv[]) { + uint8_t nb_ports = 1; + int rc = 0; + /* Initialize GoogleTest&Mock and parse any args */ testing::InitGoogleMock(&argc, argv); - /* Initialize EAL */ int ret = rte_eal_init(argc, argv); if (ret < 0) @@ -31,5 +44,19 @@ int main(int argc, char *argv[]) argc -= ret; argv += ret; + /* + * Creates a new mempool in memory to hold the mbufs. + * Multiplied by 2 because of mempeool to be used for packet + * fragmentation purposes. + */ + mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", + 2 * NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0, + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); + if (mbuf_pool == NULL) { + rc = -rte_errno; + printf("Mempool was not created, rc=%d\n", rc); + return rc; + } + return RUN_ALL_TESTS(); } |