DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: reshma.pattan@intel.com
Subject: [dpdk-dev] [PATCH] test: fix prefix discovery
Date: Mon, 16 Jul 2018 14:57:07 +0100	[thread overview]
Message-ID: <ccaf5f7c79b1da882dafdcd057585bd1bd20b150.1531747666.git.anatoly.burakov@intel.com> (raw)

Config file has moved, but the tests weren't updated to point to
its new location. Update the code to find current prefix.

Fixes: adf1d867361c ("eal: move runtime config file to new location")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 test/test/test_eal_flags.c    | 9 ++-------
 test/test/test_mp_secondary.c | 7 +------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/test/test/test_eal_flags.c b/test/test/test_eal_flags.c
index f840ca50b..e0887af21 100644
--- a/test/test/test_eal_flags.c
+++ b/test/test/test_eal_flags.c
@@ -234,13 +234,8 @@ get_current_prefix(char * prefix, int size)
 	if (readlink(path, buf, sizeof(buf)) == -1)
 		return NULL;
 
-	/* get the basename */
-	snprintf(buf, sizeof(buf), "%s", basename(buf));
-
-	/* copy string all the way from second char up to start of _config */
-	snprintf(prefix, size, "%.*s",
-			(int)(strnlen(buf, sizeof(buf)) - sizeof("_config")),
-			&buf[1]);
+	/* get the prefix */
+	snprintf(prefix, size, "%s", basename(dirname(buf)));
 
 	return prefix;
 }
diff --git a/test/test/test_mp_secondary.c b/test/test/test_mp_secondary.c
index cc46cf4de..8d22240cf 100644
--- a/test/test/test_mp_secondary.c
+++ b/test/test/test_mp_secondary.c
@@ -65,12 +65,7 @@ get_current_prefix(char * prefix, int size)
 		return NULL;
 
 	/* get the basename */
-	snprintf(buf, sizeof(buf), "%s", basename(buf));
-
-	/* copy string all the way from second char up to start of _config */
-	snprintf(prefix, size, "%.*s",
-			(int)(strnlen(buf, sizeof(buf)) - sizeof("_config")),
-			&buf[1]);
+	snprintf(prefix, size, "%s", basename(dirname(buf)));
 
 	return prefix;
 }
-- 
2.17.1

             reply	other threads:[~2018-07-16 13:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 13:57 Anatoly Burakov [this message]
2018-07-16 15:21 ` Pattan, Reshma
2018-07-25 13:44 ` [dpdk-dev] [PATCH v2] " Anatoly Burakov
2018-07-26 19:33   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ccaf5f7c79b1da882dafdcd057585bd1bd20b150.1531747666.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=reshma.pattan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).