All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test: fix prefix discovery
@ 2018-07-16 13:57 Anatoly Burakov
  2018-07-16 15:21 ` Pattan, Reshma
  2018-07-25 13:44 ` [PATCH v2] " Anatoly Burakov
  0 siblings, 2 replies; 4+ messages in thread
From: Anatoly Burakov @ 2018-07-16 13:57 UTC (permalink / raw)
  To: dev; +Cc: reshma.pattan

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-26 19:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 13:57 [PATCH] test: fix prefix discovery Anatoly Burakov
2018-07-16 15:21 ` Pattan, Reshma
2018-07-25 13:44 ` [PATCH v2] " Anatoly Burakov
2018-07-26 19:33   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.