From patchwork Mon Jul 16 13:57:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 43102 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 01749271; Mon, 16 Jul 2018 15:57:18 +0200 (CEST) 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2018 06:57:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,361,1526367600"; d="scan'208";a="67323595" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 16 Jul 2018 06:57:08 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w6GDv73f028347; Mon, 16 Jul 2018 14:57:07 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w6GDv7bI032375; Mon, 16 Jul 2018 14:57:07 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w6GDv73j032368; Mon, 16 Jul 2018 14:57:07 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: reshma.pattan@intel.com Date: Mon, 16 Jul 2018 14:57:07 +0100 Message-Id: X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] test: fix prefix discovery X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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 Acked-by: Reshma Pattan --- 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; }