diff options
author | Konstantin Ananyev <konstantin.ananyev@intel.com> | 2017-05-09 18:09:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2017-05-09 18:09:18 +0000 |
commit | 8d020909941acca43cf7e772a99682a894347526 (patch) | |
tree | 8cfe147125735d74a4d7f9e24935daf3d93d7f3e /test/gtest/main.cpp | |
parent | 36d90e3aa7ad9a72f7acbefa4d409a71d78bfd25 (diff) | |
parent | 68f21c315fccc74ee6bec7e3b19da253d2afbf60 (diff) |
Merge "tldk_test: added copy command to makefile to make test_scapy_gen.py visible"
Diffstat (limited to 'test/gtest/main.cpp')
-rw-r--r-- | test/gtest/main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/gtest/main.cpp b/test/gtest/main.cpp index 17cdccd..53dcf78 100644 --- a/test/gtest/main.cpp +++ b/test/gtest/main.cpp @@ -28,12 +28,14 @@ #include "test_common.h" struct rte_mempool *mbuf_pool; +char binpath[PATH_MAX]; int main(int argc, char *argv[]) { uint8_t nb_ports = 1; int rc = 0; + char *slash; /* Initialize GoogleTest&Mock and parse any args */ testing::InitGoogleMock(&argc, argv); @@ -44,6 +46,13 @@ main(int argc, char *argv[]) argc -= ret; argv += ret; + /* get the path of binary and save in a global variable to be used later*/ + realpath(argv[0], binpath); + slash = NULL; + slash = strrchr(binpath, '/'); + if (strcmp(binpath, "") != 0 && slash != NULL) + binpath[slash - binpath] = 0; + /* * Creates a new mempool in memory to hold the mbufs. * Multiplied by 2 because of mempeool to be used for packet |