From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH] test: fix prefix discovery Date: Mon, 16 Jul 2018 14:57:07 +0100 Message-ID: Cc: reshma.pattan@intel.com To: dev@dpdk.org Return-path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 57F96235 for ; Mon, 16 Jul 2018 15:57:16 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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