[dpdk-dev] [PATCH v5 13/13] app/test: use log register macro

jerinj at marvell.com jerinj at marvell.com
Wed Jul 1 14:33:47 CEST 2020


From: Jerin Jacob <jerinj at marvell.com>

Use log register macro to avoid the code duplication
in the log registration process.

Signed-off-by: Jerin Jacob <jerinj at marvell.com>
Acked-by: Adam Dybkowski <adamx.dybkowski at intel.com>
---
 app/test/test_efd.c            | 6 +-----
 app/test/test_hash.c           | 7 +------
 app/test/test_timer_racecond.c | 7 +------
 3 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/app/test/test_efd.c b/app/test/test_efd.c
index e3e5e30ea..3d9aa8a57 100644
--- a/app/test/test_efd.c
+++ b/app/test/test_efd.c
@@ -32,12 +32,8 @@ struct flow_key {
 	uint8_t proto;
 } __rte_packed;
 
-int efd_logtype_test;
 
-RTE_INIT(test_efd_init_log)
-{
-	efd_logtype_test = rte_log_register("test.efd");
-}
+RTE_LOG_REGISTER(efd_logtype_test, test.efd, INFO);
 
 /*
  * Print out result of unit test efd operation.
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index afa3a1a3c..990a1815f 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -69,8 +69,6 @@ struct flow_key {
 	uint8_t proto;
 } __rte_packed;
 
-int hash_logtype_test;
-
 /*
  * Hash function that always returns the same value, to easily test what
  * happens when a bucket is full.
@@ -82,10 +80,7 @@ static uint32_t pseudo_hash(__rte_unused const void *keys,
 	return 3;
 }
 
-RTE_INIT(test_hash_init_log)
-{
-	hash_logtype_test = rte_log_register("test.hash");
-}
+RTE_LOG_REGISTER(hash_logtype_test, test.hash, INFO);
 
 /*
  * Print out result of unit test hash operation.
diff --git a/app/test/test_timer_racecond.c b/app/test/test_timer_racecond.c
index 4fc917995..28af9ca76 100644
--- a/app/test/test_timer_racecond.c
+++ b/app/test/test_timer_racecond.c
@@ -61,12 +61,7 @@ static volatile unsigned stop_slaves;
 
 static int reload_timer(struct rte_timer *tim);
 
-int timer_logtype_test;
-
-RTE_INIT(test_timer_init_log)
-{
-	timer_logtype_test = rte_log_register("test.timer");
-}
+RTE_LOG_REGISTER(timer_logtype_test, test.timer, INFO);
 
 static void
 timer_cb(struct rte_timer *tim, void *arg __rte_unused)
-- 
2.27.0



More information about the dev mailing list