DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/7] fix build errors
@ 2014-08-18 11:29 David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 1/7] app: simplify makefiles David Marchand
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: David Marchand @ 2014-08-18 11:29 UTC (permalink / raw)
  To: dev

This patch series resolves build errors I encountered after disabling some parts
of the dpdk.

- simplified app/*/Makefile,
- fixed some build error when disabling refcnt,
- removed dead code (reference to pm_autotest),
- reworked all the tests from app/test to use a dynamic register mechanism
  (this makes it easier to enable/disable them),
- reworked app/test Makefile to only enable the relevant tests.

Changes since v1:
- fixed typo in first patch (RTE_CONFIG.. in app/test/Makefile)

-- 
David Marchand

David Marchand (7):
  app: simplify makefiles
  app/test: use accessor to set refcnt field
  app/test: remove pm_autotest
  app/test: introduce dynamic commands list
  app/test: convert all tests to register system
  app/test: no more builtin commands
  app/test: only build what has been selected in config

 app/cmdline_test/Makefile        |    8 +-
 app/dump_cfg/Makefile            |    5 +-
 app/test-acl/Makefile            |    9 +-
 app/test-pipeline/Makefile       |   26 ++---
 app/test-pmd/Makefile            |   40 ++++----
 app/test/Makefile                |  145 ++++++++++++++++------------
 app/test/autotest_data.py        |    6 --
 app/test/commands.c              |  193 ++++++++------------------------------
 app/test/test.c                  |    5 +
 app/test/test.h                  |   74 +++++----------
 app/test/test_acl.c              |   18 ++--
 app/test/test_alarm.c            |    7 +-
 app/test/test_atomic.c           |    7 +-
 app/test/test_byteorder.c        |    8 +-
 app/test/test_cmdline.c          |   11 ++-
 app/test/test_common.c           |    8 +-
 app/test/test_cpuflags.c         |    8 +-
 app/test/test_cycles.c           |    8 +-
 app/test/test_debug.c            |    8 +-
 app/test/test_devargs.c          |    8 +-
 app/test/test_distributor.c      |   22 ++---
 app/test/test_distributor_perf.c |   20 ++--
 app/test/test_eal_flags.c        |   20 ++--
 app/test/test_eal_fs.c           |   17 ++--
 app/test/test_errno.c            |    8 +-
 app/test/test_func_reentrancy.c  |    8 +-
 app/test/test_hash.c             |   19 ++--
 app/test/test_hash_perf.c        |   19 ++--
 app/test/test_interrupts.c       |    7 +-
 app/test/test_ivshmem.c          |   15 +--
 app/test/test_kni.c              |   18 ++--
 app/test/test_kvargs.c           |    9 +-
 app/test/test_link_bonding.c     |    8 +-
 app/test/test_logs.c             |    8 +-
 app/test/test_lpm.c              |   19 ++--
 app/test/test_lpm6.c             |   19 ++--
 app/test/test_malloc.c           |    8 +-
 app/test/test_mbuf.c             |    8 +-
 app/test/test_memcpy.c           |    8 +-
 app/test/test_memcpy_perf.c      |    8 +-
 app/test/test_memory.c           |    8 +-
 app/test/test_mempool.c          |    8 +-
 app/test/test_mempool_perf.c     |    8 +-
 app/test/test_memzone.c          |    8 +-
 app/test/test_meter.c            |   18 ++--
 app/test/test_mp_secondary.c     |   19 +---
 app/test/test_pci.c              |    6 ++
 app/test/test_per_lcore.c        |    8 +-
 app/test/test_pmd_ring.c         |   19 ++--
 app/test/test_power.c            |   20 ++--
 app/test/test_prefetch.c         |    8 +-
 app/test/test_red.c              |   20 ++--
 app/test/test_ring.c             |    8 +-
 app/test/test_ring_perf.c        |    8 +-
 app/test/test_rwlock.c           |    8 +-
 app/test/test_sched.c            |   18 ++--
 app/test/test_spinlock.c         |    8 +-
 app/test/test_string_fns.c       |    8 +-
 app/test/test_table.c            |   21 ++---
 app/test/test_table.h            |    1 -
 app/test/test_table_acl.c        |    4 -
 app/test/test_table_combined.c   |    3 -
 app/test/test_table_pipeline.c   |    8 --
 app/test/test_table_ports.c      |    4 -
 app/test/test_table_tables.c     |    4 -
 app/test/test_tailq.c            |    8 +-
 app/test/test_timer.c            |   17 ++--
 app/test/test_timer_perf.c       |   17 ++--
 app/test/test_version.c          |    8 +-
 69 files changed, 550 insertions(+), 623 deletions(-)

-- 
1.7.10.4

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

* [dpdk-dev] [PATCH v2 1/7] app: simplify makefiles
  2014-08-18 11:29 [dpdk-dev] [PATCH v2 0/7] fix build errors David Marchand
@ 2014-08-18 11:29 ` David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 2/7] app/test: use accessor to set refcnt field David Marchand
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: David Marchand @ 2014-08-18 11:29 UTC (permalink / raw)
  To: dev

No need to test some build option multiple times in a Makefile.
Besides, such option is needed by the associated app, so move it at the
top of the Makefile.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 app/cmdline_test/Makefile  |    8 ++-
 app/dump_cfg/Makefile      |    5 +-
 app/test-acl/Makefile      |    9 ++--
 app/test-pipeline/Makefile |   26 +++++-----
 app/test-pmd/Makefile      |   40 +++++++--------
 app/test/Makefile          |  122 ++++++++++++++++++++++----------------------
 6 files changed, 110 insertions(+), 100 deletions(-)

diff --git a/app/cmdline_test/Makefile b/app/cmdline_test/Makefile
index 11c3aba..e9eafd2 100644
--- a/app/cmdline_test/Makefile
+++ b/app/cmdline_test/Makefile
@@ -31,6 +31,8 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
+
 #
 # library name
 #
@@ -39,10 +41,12 @@ APP = cmdline_test
 #
 # all sources are stored in SRCS-y
 #
-SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_test.c
-SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += commands.c
+SRCS-y += cmdline_test.c
+SRCS-y += commands.c
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
 include $(RTE_SDK)/mk/rte.app.mk
+
+endif
diff --git a/app/dump_cfg/Makefile b/app/dump_cfg/Makefile
index 4c0714e..3257127 100644
--- a/app/dump_cfg/Makefile
+++ b/app/dump_cfg/Makefile
@@ -40,7 +40,6 @@ CFLAGS += $(WERROR_FLAGS)
 SRCS-y := main.c
 
 # this application needs libraries first
- DEPDIRS-y += lib
-
- include $(RTE_SDK)/mk/rte.app.mk
+DEPDIRS-y += lib
 
+include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-acl/Makefile b/app/test-acl/Makefile
index 00fa3b6..43dfdcb 100644
--- a/app/test-acl/Makefile
+++ b/app/test-acl/Makefile
@@ -31,15 +31,18 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
+
 APP = testacl
 
 CFLAGS += $(WERROR_FLAGS)
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_ACL) := main.c
+SRCS-y := main.c
 
 # this application needs libraries first
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ACL) += lib
-
+DEPDIRS-y += lib
 
 include $(RTE_SDK)/mk/rte.app.mk
+
+endif
diff --git a/app/test-pipeline/Makefile b/app/test-pipeline/Makefile
index 6cc0985..b81652f 100644
--- a/app/test-pipeline/Makefile
+++ b/app/test-pipeline/Makefile
@@ -31,6 +31,8 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
+
 #
 # library name
 #
@@ -46,21 +48,21 @@ endif
 #
 # all source are stored in SRCS-y
 #
-SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c
-SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config.c
-SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c
-SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += runtime.c
-SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_stub.c
-SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_hash.c
-SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_lpm.c
-SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_lpm_ipv6.c
+SRCS-y := main.c
+SRCS-y += config.c
+SRCS-y += init.c
+SRCS-y += runtime.c
+SRCS-y += pipeline_stub.c
+SRCS-y += pipeline_hash.c
+SRCS-y += pipeline_lpm.c
+SRCS-y += pipeline_lpm_ipv6.c
 
 # include ACL lib if available
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_acl.c
-endif
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += pipeline_acl.c
 
 # this application needs libraries first
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib
+DEPDIRS-y += lib
 
 include $(RTE_SDK)/mk/rte.app.mk
+
+endif
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index debf880..97dc2e6 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -31,6 +31,8 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+ifeq ($(CONFIG_RTE_TEST_PMD),y)
+
 #
 # library name
 #
@@ -46,25 +48,21 @@ endif
 #
 # all source are stored in SRCS-y
 #
-SRCS-$(CONFIG_RTE_TEST_PMD) := testpmd.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += parameters.c
-ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
-SRCS-$(CONFIG_RTE_TEST_PMD) += cmdline.c
-endif
-SRCS-$(CONFIG_RTE_TEST_PMD) += config.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += iofwd.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += macfwd.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += macfwd-retry.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += macswap.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += flowgen.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += rxonly.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += txonly.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += csumonly.c
-SRCS-$(CONFIG_RTE_TEST_PMD) += icmpecho.c
-ifeq ($(CONFIG_RTE_LIBRTE_IEEE1588),y)
-SRCS-$(CONFIG_RTE_TEST_PMD) += ieee1588fwd.c
-endif
-SRCS-$(CONFIG_RTE_TEST_PMD) += mempool_anon.c
+SRCS-y := testpmd.c
+SRCS-y += parameters.c
+SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline.c
+SRCS-y += config.c
+SRCS-y += iofwd.c
+SRCS-y += macfwd.c
+SRCS-y += macfwd-retry.c
+SRCS-y += macswap.c
+SRCS-y += flowgen.c
+SRCS-y += rxonly.c
+SRCS-y += txonly.c
+SRCS-y += csumonly.c
+SRCS-y += icmpecho.c
+SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
+SRCS-y += mempool_anon.c
 
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 CFLAGS_mempool_anon.o := -D_GNU_SOURCE
@@ -72,6 +70,8 @@ endif
 CFLAGS_cmdline.o := -D_GNU_SOURCE
 
 # this application needs libraries first
-DEPDIRS-$(CONFIG_RTE_TEST_PMD) += lib
+DEPDIRS-y += lib
 
 include $(RTE_SDK)/mk/rte.app.mk
+
+endif
diff --git a/app/test/Makefile b/app/test/Makefile
index 0024737..445405a 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -31,6 +31,8 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+ifeq ($(CONFIG_RTE_APP_TEST),y)
+
 #
 # library name
 #
@@ -40,50 +42,50 @@ APP = test
 # all sources are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := commands.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_pci.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_prefetch.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_byteorder.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_per_lcore.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_atomic.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_malloc.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_cycles.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_spinlock.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_memory.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_memzone.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_ring.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_table.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_table_pipeline.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_table_tables.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_table_ports.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_table_combined.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_table_acl.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_ring_perf.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_rwlock.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_timer.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_mempool.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_mempool_perf.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_mbuf.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_logs.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_memcpy.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_memcpy_perf.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_hash.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_hash_perf.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_lpm.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_lpm6.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_debug.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_errno.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_tailq.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_string_fns.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_mp_secondary.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_cpuflags.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_eal_flags.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_alarm.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_interrupts.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_version.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_eal_fs.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_func_reentrancy.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_cmdline.c
+SRCS-y += test.c
+SRCS-y += test_pci.c
+SRCS-y += test_prefetch.c
+SRCS-y += test_byteorder.c
+SRCS-y += test_per_lcore.c
+SRCS-y += test_atomic.c
+SRCS-y += test_malloc.c
+SRCS-y += test_cycles.c
+SRCS-y += test_spinlock.c
+SRCS-y += test_memory.c
+SRCS-y += test_memzone.c
+SRCS-y += test_ring.c
+SRCS-y += test_table.c
+SRCS-y += test_table_pipeline.c
+SRCS-y += test_table_tables.c
+SRCS-y += test_table_ports.c
+SRCS-y += test_table_combined.c
+SRCS-y += test_table_acl.c
+SRCS-y += test_ring_perf.c
+SRCS-y += test_rwlock.c
+SRCS-y += test_timer.c
+SRCS-y += test_mempool.c
+SRCS-y += test_mempool_perf.c
+SRCS-y += test_mbuf.c
+SRCS-y += test_logs.c
+SRCS-y += test_memcpy.c
+SRCS-y += test_memcpy_perf.c
+SRCS-y += test_hash.c
+SRCS-y += test_hash_perf.c
+SRCS-y += test_lpm.c
+SRCS-y += test_lpm6.c
+SRCS-y += test_debug.c
+SRCS-y += test_errno.c
+SRCS-y += test_tailq.c
+SRCS-y += test_string_fns.c
+SRCS-y += test_mp_secondary.c
+SRCS-y += test_cpuflags.c
+SRCS-y += test_eal_flags.c
+SRCS-y += test_alarm.c
+SRCS-y += test_interrupts.c
+SRCS-y += test_version.c
+SRCS-y += test_eal_fs.c
+SRCS-y += test_func_reentrancy.c
+SRCS-y += test_cmdline.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_num.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_etheraddr.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_portlist.c
@@ -91,25 +93,23 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_ipaddr.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_cirbuf.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_string.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_lib.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_red.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_sched.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_meter.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_kni.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_power.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_common.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_timer_perf.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_ivshmem.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_distributor.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_distributor_perf.c
-SRCS-$(CONFIG_RTE_APP_TEST) += test_devargs.c
-SRCS-$(CONFIG_RTE_APP_TEST) += virtual_pmd.c
-SRCS-$(CONFIG_RTE_APP_TEST) += packet_burst_generator.c
-ifeq ($(CONFIG_RTE_APP_TEST),y)
+SRCS-y += test_red.c
+SRCS-y += test_sched.c
+SRCS-y += test_meter.c
+SRCS-y += test_kni.c
+SRCS-y += test_power.c
+SRCS-y += test_common.c
+SRCS-y += test_timer_perf.c
+SRCS-y += test_ivshmem.c
+SRCS-y += test_distributor.c
+SRCS-y += test_distributor_perf.c
+SRCS-y += test_devargs.c
+SRCS-y += virtual_pmd.c
+SRCS-y += packet_burst_generator.c
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_acl.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c
 SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
-endif
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
@@ -130,6 +130,8 @@ endif
 CFLAGS += -D_GNU_SOURCE
 
 # this application needs libraries first
-DEPDIRS-$(CONFIG_RTE_APP_TEST) += lib
+DEPDIRS-y += lib
 
 include $(RTE_SDK)/mk/rte.app.mk
+
+endif
-- 
1.7.10.4

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

* [dpdk-dev] [PATCH v2 2/7] app/test: use accessor to set refcnt field
  2014-08-18 11:29 [dpdk-dev] [PATCH v2 0/7] fix build errors David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 1/7] app: simplify makefiles David Marchand
@ 2014-08-18 11:29 ` David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 3/7] app/test: remove pm_autotest David Marchand
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: David Marchand @ 2014-08-18 11:29 UTC (permalink / raw)
  To: dev

refcnt field can not be accessed directly as it depends on the RTE_MBUF_REFCNT
build option.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 app/test/test_distributor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index e7dc1fb..7648ed1 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -282,7 +282,7 @@ sanity_test_with_mbuf_alloc(struct rte_distributor *d, struct rte_mempool *p)
 			rte_distributor_process(d, NULL, 0);
 		for (j = 0; j < BURST; j++) {
 			bufs[j]->pkt.hash.rss = (i+j) << 1;
-			bufs[j]->refcnt = 1;
+			rte_mbuf_refcnt_set(bufs[j], 1);
 		}
 
 		rte_distributor_process(d, bufs, BURST);
-- 
1.7.10.4

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

* [dpdk-dev] [PATCH v2 3/7] app/test: remove pm_autotest
  2014-08-18 11:29 [dpdk-dev] [PATCH v2 0/7] fix build errors David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 1/7] app: simplify makefiles David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 2/7] app/test: use accessor to set refcnt field David Marchand
@ 2014-08-18 11:29 ` David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 4/7] app/test: introduce dynamic commands list David Marchand
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: David Marchand @ 2014-08-18 11:29 UTC (permalink / raw)
  To: dev

This test is not linked to any code, remove it.
It may be some leftover from 24f42575dfe2226f126546d0ca501cba9fbd6373.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 app/test/autotest_data.py |    6 ------
 app/test/commands.c       |    2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/app/test/autotest_data.py b/app/test/autotest_data.py
index d0c55c8..878c72e 100644
--- a/app/test/autotest_data.py
+++ b/app/test/autotest_data.py
@@ -340,12 +340,6 @@ parallel_test_group_list = [
 		 "Func" :	default_autotest,
 		 "Report" :	None,
 		},
-		{
-		 "Name" :	"Pattern match autotest",
-		 "Command" : 	"pm_autotest",
-		 "Func" :	default_autotest,
-		 "Report" :	None,
-		},
 		 {
 		 "Name" :"Sched autotest",
 		 "Command" : "sched_autotest",
diff --git a/app/test/commands.c b/app/test/commands.c
index 5f23420..4a0cc05 100644
--- a/app/test/commands.c
+++ b/app/test/commands.c
@@ -238,7 +238,7 @@ cmdline_parse_token_string_t cmd_autotest_autotest =
 			"memcpy_perf_autotest#ring_perf_autotest#"
 			"red_autotest#meter_autotest#sched_autotest#"
 			"memcpy_perf_autotest#kni_autotest#"
-			"pm_autotest#ivshmem_autotest#"
+			"ivshmem_autotest#"
 			"devargs_autotest#table_autotest#"
 #ifdef RTE_LIBRTE_ACL
 			"acl_autotest#"
-- 
1.7.10.4

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

* [dpdk-dev] [PATCH v2 4/7] app/test: introduce dynamic commands list
  2014-08-18 11:29 [dpdk-dev] [PATCH v2 0/7] fix build errors David Marchand
                   ` (2 preceding siblings ...)
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 3/7] app/test: remove pm_autotest David Marchand
@ 2014-08-18 11:29 ` David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 5/7] app/test: convert all tests to register system David Marchand
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: David Marchand @ 2014-08-18 11:29 UTC (permalink / raw)
  To: dev

This patch adds a way to dynamically add a test without modifying commands.c.
Move all current tests in a builtin_commands[] list, next patch will convert
them to this new system.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 app/test/commands.c |  118 ++++++++++++++++++++++++++++++++++-----------------
 app/test/test.c     |    3 ++
 app/test/test.h     |   21 +++++++++
 3 files changed, 103 insertions(+), 39 deletions(-)

diff --git a/app/test/commands.c b/app/test/commands.c
index 4a0cc05..a1ffd43 100644
--- a/app/test/commands.c
+++ b/app/test/commands.c
@@ -78,6 +78,15 @@
 
 /****************/
 
+static struct test_commands_list commands_list =
+	TAILQ_HEAD_INITIALIZER(commands_list);
+
+void
+add_test_command(struct test_command *t)
+{
+	TAILQ_INSERT_TAIL(&commands_list, t, next);
+}
+
 struct cmd_autotest_result {
 	cmdline_fixed_string_t autotest;
 };
@@ -86,9 +95,15 @@ static void cmd_autotest_parsed(void *parsed_result,
 				__attribute__((unused)) struct cmdline *cl,
 				__attribute__((unused)) void *data)
 {
+	struct test_command *t;
 	struct cmd_autotest_result *res = parsed_result;
 	int ret = 0;
 
+	TAILQ_FOREACH(t, &commands_list, next) {
+		if (!strcmp(res->autotest, t->command))
+			ret = t->callback();
+	}
+
 	if (!strcmp(res->autotest, "version_autotest"))
 		ret = test_version();
 	if (!strcmp(res->autotest, "eal_fs_autotest"))
@@ -214,45 +229,7 @@ static void cmd_autotest_parsed(void *parsed_result,
 
 cmdline_parse_token_string_t cmd_autotest_autotest =
 	TOKEN_STRING_INITIALIZER(struct cmd_autotest_result, autotest,
-			"pci_autotest#memory_autotest#"
-			"per_lcore_autotest#spinlock_autotest#"
-			"rwlock_autotest#atomic_autotest#"
-			"byteorder_autotest#prefetch_autotest#"
-			"cycles_autotest#logs_autotest#"
-			"memzone_autotest#ring_autotest#"
-			"mempool_autotest#mbuf_autotest#"
-			"timer_autotest#malloc_autotest#"
-			"memcpy_autotest#hash_autotest#"
-			"lpm_autotest#debug_autotest#"
-			"lpm6_autotest#"
-			"errno_autotest#tailq_autotest#"
-			"string_autotest#multiprocess_autotest#"
-			"cpuflags_autotest#eal_flags_autotest#"
-			"alarm_autotest#interrupt_autotest#"
-			"version_autotest#eal_fs_autotest#"
-			"cmdline_autotest#func_reentrancy_autotest#"
-#ifdef RTE_LIBRTE_PMD_BOND
-			"link_bonding_autotest#"
-#endif
-			"mempool_perf_autotest#hash_perf_autotest#"
-			"memcpy_perf_autotest#ring_perf_autotest#"
-			"red_autotest#meter_autotest#sched_autotest#"
-			"memcpy_perf_autotest#kni_autotest#"
-			"ivshmem_autotest#"
-			"devargs_autotest#table_autotest#"
-#ifdef RTE_LIBRTE_ACL
-			"acl_autotest#"
-#endif
-			"power_autotest#"
-			"timer_perf_autotest#"
-#ifdef RTE_LIBRTE_PMD_RING
-			"ring_pmd_autotest#"
-#endif
-#ifdef RTE_LIBRTE_KVARGS
-			"kvargs_autotest#"
-#endif
-			"common_autotest#"
-			"distributor_autotest#distributor_perf_autotest");
+				 "");
 
 cmdline_parse_inst_t cmd_autotest = {
 	.f = cmd_autotest_parsed,  /* function to call */
@@ -460,3 +437,66 @@ cmdline_parse_ctx_t main_ctx[] = {
 	NULL,
 };
 
+int commands_init(void)
+{
+	struct test_command *t;
+	char builtin_commands[] =
+			"pci_autotest#memory_autotest#"
+			"per_lcore_autotest#spinlock_autotest#"
+			"rwlock_autotest#atomic_autotest#"
+			"byteorder_autotest#prefetch_autotest#"
+			"cycles_autotest#logs_autotest#"
+			"memzone_autotest#ring_autotest#"
+			"mempool_autotest#mbuf_autotest#"
+			"timer_autotest#malloc_autotest#"
+			"memcpy_autotest#hash_autotest#"
+			"lpm_autotest#debug_autotest#"
+			"lpm6_autotest#"
+			"errno_autotest#tailq_autotest#"
+			"string_autotest#multiprocess_autotest#"
+			"cpuflags_autotest#eal_flags_autotest#"
+			"alarm_autotest#interrupt_autotest#"
+			"version_autotest#eal_fs_autotest#"
+			"cmdline_autotest#func_reentrancy_autotest#"
+#ifdef RTE_LIBRTE_PMD_BOND
+			"link_bonding_autotest#"
+#endif
+			"mempool_perf_autotest#hash_perf_autotest#"
+			"memcpy_perf_autotest#ring_perf_autotest#"
+			"red_autotest#meter_autotest#sched_autotest#"
+			"memcpy_perf_autotest#kni_autotest#"
+			"ivshmem_autotest#"
+			"devargs_autotest#table_autotest#"
+#ifdef RTE_LIBRTE_ACL
+			"acl_autotest#"
+#endif
+			"power_autotest#"
+			"timer_perf_autotest#"
+#ifdef RTE_LIBRTE_PMD_RING
+			"ring_pmd_autotest#"
+#endif
+#ifdef RTE_LIBRTE_KVARGS
+			"kvargs_autotest#"
+#endif
+			"common_autotest#"
+			"distributor_autotest#distributor_perf_autotest";
+	char *commands, *ptr;
+	int commands_len = strlen(builtin_commands) + 1;
+
+	TAILQ_FOREACH(t, &commands_list, next) {
+		commands_len += strlen(t->command) + 1;
+	}
+
+	commands = malloc(commands_len);
+	if (!commands)
+		return -1;
+
+	ptr = commands;
+	TAILQ_FOREACH(t, &commands_list, next) {
+		ptr += sprintf(ptr, "%s#", t->command);
+	}
+	ptr += sprintf(ptr, "%s", builtin_commands);
+
+	cmd_autotest_autotest.string_data.str = commands;
+	return 0;
+}
diff --git a/app/test/test.c b/app/test/test.c
index 589a168..a33b2b5 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -126,6 +126,9 @@ main(int argc, char **argv)
 	rte_timer_subsystem_init();
 #endif
 
+	if (commands_init() < 0)
+		return -1;
+
 	argv += ret;
 
 	prgname = argv[0];
diff --git a/app/test/test.h b/app/test/test.h
index 181c38e..bba0ec5 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -34,6 +34,8 @@
 #ifndef _TEST_H_
 #define _TEST_H_
 
+#include <sys/queue.h>
+
 #define TEST_ASSERT(cond, msg, ...) do {						\
 		if (!(cond)) {											\
 			printf("TestCase %s() line %d failed: "			\
@@ -125,6 +127,8 @@ int unit_test_suite_runner(struct unit_test_suite *suite);
 
 extern const char *prgname;
 
+int commands_init(void);
+
 int main(int argc, char **argv);
 
 int test_pci(void);
@@ -183,4 +187,21 @@ int test_link_bonding(void);
 
 int test_pci_run;
 
+typedef int (test_callback)(void);
+TAILQ_HEAD(test_commands_list, test_command);
+struct test_command {
+	TAILQ_ENTRY(test_command) next;
+	const char *command;
+	test_callback *callback;
+};
+
+void add_test_command(struct test_command *t);
+
+#define REGISTER_TEST_COMMAND(t) \
+static void testfn_##t(void);\
+void __attribute__((constructor, used)) testfn_##t(void)\
+{\
+	add_test_command(&t);\
+}
+
 #endif
-- 
1.7.10.4

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

* [dpdk-dev] [PATCH v2 5/7] app/test: convert all tests to register system
  2014-08-18 11:29 [dpdk-dev] [PATCH v2 0/7] fix build errors David Marchand
                   ` (3 preceding siblings ...)
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 4/7] app/test: introduce dynamic commands list David Marchand
@ 2014-08-18 11:29 ` David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 6/7] app/test: no more builtin commands David Marchand
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: David Marchand @ 2014-08-18 11:29 UTC (permalink / raw)
  To: dev

Remove all tests from the builtin commands list and use the dynamic commands
list register macro.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 app/test/commands.c              |  157 +-------------------------------------
 app/test/test.c                  |    2 +
 app/test/test.h                  |   55 +------------
 app/test/test_acl.c              |   15 ++--
 app/test/test_alarm.c            |    7 +-
 app/test/test_atomic.c           |    7 +-
 app/test/test_byteorder.c        |    8 +-
 app/test/test_cmdline.c          |   13 ++--
 app/test/test_common.c           |    8 +-
 app/test/test_cpuflags.c         |    8 +-
 app/test/test_cycles.c           |    8 +-
 app/test/test_debug.c            |    8 +-
 app/test/test_devargs.c          |    8 +-
 app/test/test_distributor.c      |   18 ++---
 app/test/test_distributor_perf.c |   18 ++---
 app/test/test_eal_flags.c        |   18 ++---
 app/test/test_eal_fs.c           |   15 ++--
 app/test/test_errno.c            |    8 +-
 app/test/test_func_reentrancy.c  |    8 +-
 app/test/test_hash.c             |   16 ++--
 app/test/test_hash_perf.c        |   16 ++--
 app/test/test_interrupts.c       |    7 +-
 app/test/test_ivshmem.c          |   12 ++-
 app/test/test_kni.c              |   16 ++--
 app/test/test_kvargs.c           |    9 ++-
 app/test/test_link_bonding.c     |    8 +-
 app/test/test_logs.c             |    8 +-
 app/test/test_lpm.c              |   16 ++--
 app/test/test_lpm6.c             |   16 ++--
 app/test/test_malloc.c           |    8 +-
 app/test/test_mbuf.c             |    8 +-
 app/test/test_memcpy.c           |    8 +-
 app/test/test_memcpy_perf.c      |    8 +-
 app/test/test_memory.c           |    8 +-
 app/test/test_mempool.c          |    8 +-
 app/test/test_mempool_perf.c     |    8 +-
 app/test/test_memzone.c          |    8 +-
 app/test/test_meter.c            |   15 ++--
 app/test/test_mp_secondary.c     |   17 ++---
 app/test/test_pci.c              |    6 ++
 app/test/test_per_lcore.c        |    8 +-
 app/test/test_pmd_ring.c         |   15 ++--
 app/test/test_power.c            |   16 ++--
 app/test/test_prefetch.c         |    8 +-
 app/test/test_red.c              |   17 ++---
 app/test/test_ring.c             |    8 +-
 app/test/test_ring_perf.c        |    8 +-
 app/test/test_rwlock.c           |    8 +-
 app/test/test_sched.c            |   15 ++--
 app/test/test_spinlock.c         |    8 +-
 app/test/test_string_fns.c       |    8 +-
 app/test/test_table.c            |   19 ++---
 app/test/test_table.h            |    1 -
 app/test/test_tailq.c            |    8 +-
 app/test/test_timer.c            |   15 ++--
 app/test/test_timer_perf.c       |   15 ++--
 app/test/test_version.c          |    8 +-
 57 files changed, 358 insertions(+), 442 deletions(-)

diff --git a/app/test/commands.c b/app/test/commands.c
index a1ffd43..0640ac9 100644
--- a/app/test/commands.c
+++ b/app/test/commands.c
@@ -104,122 +104,6 @@ static void cmd_autotest_parsed(void *parsed_result,
 			ret = t->callback();
 	}
 
-	if (!strcmp(res->autotest, "version_autotest"))
-		ret = test_version();
-	if (!strcmp(res->autotest, "eal_fs_autotest"))
-		ret = test_eal_fs();
-	if (!strcmp(res->autotest, "debug_autotest"))
-		ret = test_debug();
-	if (!strcmp(res->autotest, "pci_autotest"))
-		ret = test_pci();
-	if (!strcmp(res->autotest, "prefetch_autotest"))
-		ret = test_prefetch();
-	if (!strcmp(res->autotest, "byteorder_autotest"))
-		ret = test_byteorder();
-	if (!strcmp(res->autotest, "per_lcore_autotest"))
-		ret = test_per_lcore();
-	if (!strcmp(res->autotest, "atomic_autotest"))
-		ret = test_atomic();
-	if (!strcmp(res->autotest, "malloc_autotest"))
-		ret = test_malloc();
-	if (!strcmp(res->autotest, "spinlock_autotest"))
-		ret = test_spinlock();
-	if (!strcmp(res->autotest, "memory_autotest"))
-		ret = test_memory();
-	if (!strcmp(res->autotest, "memzone_autotest"))
-		ret = test_memzone();
-	if (!strcmp(res->autotest, "rwlock_autotest"))
-		ret = test_rwlock();
-	if (!strcmp(res->autotest, "mbuf_autotest"))
-		ret = test_mbuf();
-	if (!strcmp(res->autotest, "logs_autotest"))
-		ret = test_logs();
-	if (!strcmp(res->autotest, "errno_autotest"))
-		ret = test_errno();
-	if (!strcmp(res->autotest, "hash_autotest"))
-		ret = test_hash();
-	if (!strcmp(res->autotest, "hash_perf_autotest"))
-		ret = test_hash_perf();
-	if (!strcmp(res->autotest, "lpm_autotest"))
-		ret = test_lpm();
-	if (!strcmp(res->autotest, "lpm6_autotest"))
-		ret = test_lpm6();
-	if (!strcmp(res->autotest, "cpuflags_autotest"))
-		ret = test_cpuflags();
-	if (!strcmp(res->autotest, "cmdline_autotest"))
-		ret = test_cmdline();
-	if (!strcmp(res->autotest, "tailq_autotest"))
-		ret = test_tailq();
-	if (!strcmp(res->autotest, "multiprocess_autotest"))
-		ret = test_mp_secondary();
-	if (!strcmp(res->autotest, "memcpy_autotest"))
-		ret = test_memcpy();
-	if (!strcmp(res->autotest, "string_autotest"))
-		ret = test_string_fns();
-	if (!strcmp(res->autotest, "eal_flags_autotest"))
-		ret = test_eal_flags();
-	if (!strcmp(res->autotest, "alarm_autotest"))
-		ret = test_alarm();
-	if (!strcmp(res->autotest, "interrupt_autotest"))
-		ret = test_interrupt();
-	if (!strcmp(res->autotest, "cycles_autotest"))
-		ret = test_cycles();
-	if (!strcmp(res->autotest, "ring_autotest"))
-		ret = test_ring();
-	if (!strcmp(res->autotest, "table_autotest"))
-		ret = test_table();
-	if (!strcmp(res->autotest, "ring_perf_autotest"))
-		ret = test_ring_perf();
-	if (!strcmp(res->autotest, "timer_autotest"))
-		ret = test_timer();
-	if (!strcmp(res->autotest, "timer_perf_autotest"))
-		ret = test_timer_perf();
-#ifdef RTE_LIBRTE_PMD_BOND
-	if (!strcmp(res->autotest, "link_bonding_autotest"))
-		ret = test_link_bonding();
-#endif
-	if (!strcmp(res->autotest, "mempool_autotest"))
-		ret = test_mempool();
-	if (!strcmp(res->autotest, "mempool_perf_autotest"))
-		ret = test_mempool_perf();
-	if (!strcmp(res->autotest, "memcpy_perf_autotest"))
-		ret = test_memcpy_perf();
-	if (!strcmp(res->autotest, "func_reentrancy_autotest"))
-		ret = test_func_reentrancy();
-	if (!strcmp(res->autotest, "red_autotest"))
-		ret = test_red();
-	if (!strcmp(res->autotest, "sched_autotest"))
-		ret = test_sched();
-	if (!strcmp(res->autotest, "meter_autotest"))
-		ret = test_meter();
-	if (!strcmp(res->autotest, "kni_autotest"))
-		ret = test_kni();
-	if (!strcmp(res->autotest, "power_autotest"))
-		ret = test_power();
-	if (!strcmp(res->autotest, "common_autotest"))
-		ret = test_common();
-	if (!strcmp(res->autotest, "ivshmem_autotest"))
-		ret = test_ivshmem();
-	if (!strcmp(res->autotest, "distributor_autotest"))
-		ret = test_distributor();
-	if (!strcmp(res->autotest, "distributor_perf_autotest"))
-		ret = test_distributor_perf();
-	if (!strcmp(res->autotest, "devargs_autotest"))
-		ret = test_devargs();
-#ifdef RTE_LIBRTE_PMD_RING
-	if (!strcmp(res->autotest, "ring_pmd_autotest"))
-		ret = test_pmd_ring();
-#endif /* RTE_LIBRTE_PMD_RING */
-
-#ifdef RTE_LIBRTE_ACL
-	if (!strcmp(res->autotest, "acl_autotest"))
-		ret = test_acl();
-#endif /* RTE_LIBRTE_ACL */
-#ifdef RTE_LIBRTE_KVARGS
-	if (!strcmp(res->autotest, "kvargs_autotest"))
-		ret |= test_kvargs();
-#endif /* RTE_LIBRTE_KVARGS */
-
 	if (ret == 0)
 		printf("Test OK\n");
 	else
@@ -440,46 +324,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 int commands_init(void)
 {
 	struct test_command *t;
-	char builtin_commands[] =
-			"pci_autotest#memory_autotest#"
-			"per_lcore_autotest#spinlock_autotest#"
-			"rwlock_autotest#atomic_autotest#"
-			"byteorder_autotest#prefetch_autotest#"
-			"cycles_autotest#logs_autotest#"
-			"memzone_autotest#ring_autotest#"
-			"mempool_autotest#mbuf_autotest#"
-			"timer_autotest#malloc_autotest#"
-			"memcpy_autotest#hash_autotest#"
-			"lpm_autotest#debug_autotest#"
-			"lpm6_autotest#"
-			"errno_autotest#tailq_autotest#"
-			"string_autotest#multiprocess_autotest#"
-			"cpuflags_autotest#eal_flags_autotest#"
-			"alarm_autotest#interrupt_autotest#"
-			"version_autotest#eal_fs_autotest#"
-			"cmdline_autotest#func_reentrancy_autotest#"
-#ifdef RTE_LIBRTE_PMD_BOND
-			"link_bonding_autotest#"
-#endif
-			"mempool_perf_autotest#hash_perf_autotest#"
-			"memcpy_perf_autotest#ring_perf_autotest#"
-			"red_autotest#meter_autotest#sched_autotest#"
-			"memcpy_perf_autotest#kni_autotest#"
-			"ivshmem_autotest#"
-			"devargs_autotest#table_autotest#"
-#ifdef RTE_LIBRTE_ACL
-			"acl_autotest#"
-#endif
-			"power_autotest#"
-			"timer_perf_autotest#"
-#ifdef RTE_LIBRTE_PMD_RING
-			"ring_pmd_autotest#"
-#endif
-#ifdef RTE_LIBRTE_KVARGS
-			"kvargs_autotest#"
-#endif
-			"common_autotest#"
-			"distributor_autotest#distributor_perf_autotest";
+	char builtin_commands[] = "";
 	char *commands, *ptr;
 	int commands_len = strlen(builtin_commands) + 1;
 
diff --git a/app/test/test.c b/app/test/test.c
index a33b2b5..9bee6bb 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -96,7 +96,9 @@ do_recursive_call(void)
 			{ "test_memory_flags", no_action },
 			{ "test_file_prefix", no_action },
 			{ "test_no_huge_flag", no_action },
+#ifdef RTE_LIBRTE_IVSHMEM
 			{ "test_ivshmem", test_ivshmem },
+#endif
 	};
 
 	if (recursive_call == NULL)
diff --git a/app/test/test.h b/app/test/test.h
index bba0ec5..98ab804 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -132,60 +132,11 @@ int commands_init(void);
 int main(int argc, char **argv);
 
 int test_pci(void);
-int test_memory(void);
-int test_per_lcore(void);
-int test_spinlock(void);
-int test_rwlock(void);
-int test_atomic(void);
-int test_byteorder(void);
-int test_prefetch(void);
-int test_cycles(void);
-int test_logs(void);
-int test_memzone(void);
-int test_ring(void);
-int test_table(void);
-int test_ring_perf(void);
-int test_mempool(void);
-int test_mempool_perf(void);
-int test_mbuf(void);
-int test_timer(void);
-int test_timer_perf(void);
-int test_malloc(void);
-int test_memcpy(void);
-int test_memcpy_perf(void);
-int test_hash(void);
-int test_hash_perf(void);
-int test_lpm(void);
-int test_lpm6(void);
-int test_debug(void);
-int test_errno(void);
-int test_tailq(void);
-int test_string_fns(void);
+int test_pci_run;
+
 int test_mp_secondary(void);
-int test_cpuflags(void);
-int test_eal_flags(void);
-int test_alarm(void);
-int test_interrupt(void);
-int test_version(void);
-int test_eal_fs(void);
-int test_cmdline(void);
-int test_func_reentrancy(void);
-int test_red(void);
-int test_sched(void);
-int test_meter(void);
-int test_acl(void);
-int test_kni(void);
-int test_power(void);
-int test_common(void);
-int test_pmd_ring(void);
-int test_ivshmem(void);
-int test_distributor(void);
-int test_distributor_perf(void);
-int test_kvargs(void);
-int test_devargs(void);
-int test_link_bonding(void);
 
-int test_pci_run;
+int test_ivshmem(void);
 
 typedef int (test_callback)(void);
 TAILQ_HEAD(test_commands_list, test_command);
diff --git a/app/test/test_acl.c b/app/test/test_acl.c
index 869f6d3..4e7b470 100644
--- a/app/test/test_acl.c
+++ b/app/test/test_acl.c
@@ -910,7 +910,7 @@ test_misc(void)
 	return 0;
 }
 
-int
+static int
 test_acl(void)
 {
 	if (test_invalid_parameters() < 0)
@@ -928,13 +928,10 @@ test_acl(void)
 
 	return 0;
 }
-#else
-
-int
-test_acl(void)
-{
-	printf("This binary was not compiled with ACL support!\n");
-	return 0;
-}
 
+static struct test_command acl_cmd = {
+	.command = "acl_autotest",
+	.callback = test_acl,
+};
+REGISTER_TEST_COMMAND(acl_cmd);
 #endif /* RTE_LIBRTE_ACL */
diff --git a/app/test/test_alarm.c b/app/test/test_alarm.c
index d5bea5e..5d6f4a2 100644
--- a/app/test/test_alarm.c
+++ b/app/test/test_alarm.c
@@ -199,7 +199,7 @@ test_multi_alarms(void)
 	return 0;
 }
 
-int
+static int
 test_alarm(void)
 {
 	int count = 0;
@@ -253,3 +253,8 @@ test_alarm(void)
 	return 0;
 }
 
+static struct test_command alarm_cmd = {
+	.command = "alarm_autotest",
+	.callback = test_alarm,
+};
+REGISTER_TEST_COMMAND(alarm_cmd);
diff --git a/app/test/test_atomic.c b/app/test/test_atomic.c
index 141cc22..3347413 100644
--- a/app/test/test_atomic.c
+++ b/app/test/test_atomic.c
@@ -248,7 +248,7 @@ test_atomic_dec_and_test(__attribute__((unused)) void *arg)
 	return 0;
 }
 
-int
+static int
 test_atomic(void)
 {
 	rte_atomic16_init(&a16);
@@ -375,3 +375,8 @@ test_atomic(void)
 	return 0;
 }
 
+static struct test_command atomic_cmd = {
+	.command = "atomic_autotest",
+	.callback = test_atomic,
+};
+REGISTER_TEST_COMMAND(atomic_cmd);
diff --git a/app/test/test_byteorder.c b/app/test/test_byteorder.c
index 38f8d39..a088489 100644
--- a/app/test/test_byteorder.c
+++ b/app/test/test_byteorder.c
@@ -52,7 +52,7 @@ static volatile uint64_t u64 = 0xdeadcafebabefaceULL;
  *   size (16, 32, 64 bits)
  */
 
-int
+static int
 test_byteorder(void)
 {
 	uint16_t res_u16;
@@ -91,3 +91,9 @@ test_byteorder(void)
 
 	return 0;
 }
+
+static struct test_command byteorder_cmd = {
+	.command = "byteorder_autotest",
+	.callback = test_byteorder,
+};
+REGISTER_TEST_COMMAND(byteorder_cmd);
diff --git a/app/test/test_cmdline.c b/app/test/test_cmdline.c
index 10a3f77..9b8bd5c 100644
--- a/app/test/test_cmdline.c
+++ b/app/test/test_cmdline.c
@@ -36,10 +36,10 @@
 #include "test.h"
 #include "test_cmdline.h"
 
-int
+#ifdef RTE_LIBRTE_CMDLINE
+static int
 test_cmdline(void)
 {
-#ifdef RTE_LIBRTE_CMDLINE
 	printf("Testind parsing ethernet addresses...\n");
 	if (test_parse_etheraddr_valid() < 0)
 		return -1;
@@ -87,9 +87,12 @@ test_cmdline(void)
 	printf("Testing library functions...\n");
 	if (test_cmdline_lib() < 0)
 		return -1;
-#else
-	printf("The cmdline library is not included in this build\n");
-#endif
 	return 0;
 }
 
+static struct test_command cmdline_cmd = {
+	.command = "cmdline_autotest",
+	.callback = test_cmdline,
+};
+REGISTER_TEST_COMMAND(cmdline_cmd);
+#endif
diff --git a/app/test/test_common.c b/app/test/test_common.c
index 628201b..4b71e7b 100644
--- a/app/test/test_common.c
+++ b/app/test/test_common.c
@@ -158,7 +158,7 @@ test_align(void)
 	return 0;
 }
 
-int
+static int
 test_common(void)
 {
 	int ret = 0;
@@ -168,3 +168,9 @@ test_common(void)
 
 	return ret;
 }
+
+static struct test_command common_cmd = {
+	.command = "common_autotest",
+	.callback = test_common,
+};
+REGISTER_TEST_COMMAND(common_cmd);
diff --git a/app/test/test_cpuflags.c b/app/test/test_cpuflags.c
index cb49384..82c0197 100644
--- a/app/test/test_cpuflags.c
+++ b/app/test/test_cpuflags.c
@@ -74,7 +74,7 @@ cpu_flag_result(int result)
  * - Check if register and CPUID functions fail properly
  */
 
-int
+static int
 test_cpuflags(void)
 {
 	int result;
@@ -129,3 +129,9 @@ test_cpuflags(void)
 
 	return 0;
 }
+
+static struct test_command cpuflags_cmd = {
+	.command = "cpuflags_autotest",
+	.callback = test_cpuflags,
+};
+REGISTER_TEST_COMMAND(cpuflags_cmd);
diff --git a/app/test/test_cycles.c b/app/test/test_cycles.c
index b8d66a0..d8fa517 100644
--- a/app/test/test_cycles.c
+++ b/app/test/test_cycles.c
@@ -52,7 +52,7 @@
  *   of cycles is correct with regard to the frequency of the timer.
  */
 
-int
+static int
 test_cycles(void)
 {
 	unsigned i;
@@ -88,3 +88,9 @@ test_cycles(void)
 
 	return 0;
 }
+
+static struct test_command cycles_cmd = {
+	.command = "cycles_autotest",
+	.callback = test_cycles,
+};
+REGISTER_TEST_COMMAND(cycles_cmd);
diff --git a/app/test/test_debug.c b/app/test/test_debug.c
index 135b75d..4659e46 100644
--- a/app/test/test_debug.c
+++ b/app/test/test_debug.c
@@ -156,7 +156,7 @@ test_usage(void)
 	return 0;
 }
 
-int
+static int
 test_debug(void)
 {
 	rte_dump_stack();
@@ -169,3 +169,9 @@ test_debug(void)
 		return -1;
 	return 0;
 }
+
+static struct test_command debug_cmd = {
+	.command = "debug_autotest",
+	.callback = test_debug,
+};
+REGISTER_TEST_COMMAND(debug_cmd);
diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 63eee0b..f0acf8e 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -52,7 +52,7 @@ static void free_devargs_list(void)
 	}
 }
 
-int
+static int
 test_devargs(void)
 {
 	struct rte_devargs_list save_devargs_list;
@@ -129,3 +129,9 @@ test_devargs(void)
 	devargs_list = save_devargs_list;
 	return -1;
 }
+
+static struct test_command devargs_cmd = {
+	.command = "devargs_autotest",
+	.callback = test_devargs,
+};
+REGISTER_TEST_COMMAND(devargs_cmd);
diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index 7648ed1..b29bef8 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -503,7 +503,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
 
 #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
 
-int
+static int
 test_distributor(void)
 {
 	static struct rte_distributor *d;
@@ -581,15 +581,9 @@ err:
 	return -1;
 }
 
-#else
-
-#include <stdio.h>
-
-int
-test_distributor(void)
-{
-	printf("Distributor is not enabled in configuration\n");
-	return 0;
-}
-
+static struct test_command distributor_cmd = {
+	.command = "distributor_autotest",
+	.callback = test_distributor,
+};
+REGISTER_TEST_COMMAND(distributor_cmd);
 #endif
diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c
index 1031baa..8a6b855 100644
--- a/app/test/test_distributor_perf.c
+++ b/app/test/test_distributor_perf.c
@@ -212,7 +212,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
 
 #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
 
-int
+static int
 test_distributor_perf(void)
 {
 	static struct rte_distributor *d;
@@ -261,15 +261,9 @@ test_distributor_perf(void)
 	return 0;
 }
 
-#else
-
-#include <stdio.h>
-
-int
-test_distributor_perf(void)
-{
-	printf("Distributor is not enabled in configuration\n");
-	return 0;
-}
-
+static struct test_command distributor_perf_cmd = {
+	.command = "distributor_perf_autotest",
+	.callback = test_distributor_perf,
+};
+REGISTER_TEST_COMMAND(distributor_perf_cmd);
 #endif
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 729d4ee..2d81764 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -1204,7 +1204,7 @@ test_memory_flags(void)
 	return 0;
 }
 
-int
+static int
 test_eal_flags(void)
 {
 	int ret = 0;
@@ -1283,15 +1283,9 @@ test_eal_flags(void)
 	return ret;
 }
 
-#else
-/* Baremetal version
- * Multiprocess not applicable, so just return 0 always
- */
-int
-test_eal_flags(void)
-{
-	printf("Multi-process not possible for baremetal, cannot test EAL flags\n");
-	return 0;
-}
-
+static struct test_command eal_flags_cmd = {
+	.command = "eal_flags_autotest",
+	.callback = test_eal_flags,
+};
+REGISTER_TEST_COMMAND(eal_flags_cmd);
 #endif
diff --git a/app/test/test_eal_fs.c b/app/test/test_eal_fs.c
index b28ca6c..8d4edc1 100644
--- a/app/test/test_eal_fs.c
+++ b/app/test/test_eal_fs.c
@@ -196,18 +196,17 @@ error:
 	return -1;
 }
 
-int
+static int
 test_eal_fs(void)
 {
 	if (test_parse_sysfs_value() < 0)
 		return -1;
 	return 0;
 }
-#else
-/* baremetal does not have a filesystem */
-int
-test_eal_fs(void)
-{
-	return 0;
-}
+
+static struct test_command eal_fs_cmd = {
+	.command = "eal_fs_autotest",
+	.callback = test_eal_fs,
+};
+REGISTER_TEST_COMMAND(eal_fs_cmd);
 #endif
diff --git a/app/test/test_errno.c b/app/test/test_errno.c
index 93ad0b5..c903b19 100644
--- a/app/test/test_errno.c
+++ b/app/test/test_errno.c
@@ -42,7 +42,7 @@
 
 #include "test.h"
 
-int
+static int
 test_errno(void)
 {
 	const char *rte_retval;
@@ -112,3 +112,9 @@ test_errno(void)
 
 	return 0;
 }
+
+static struct test_command errno_cmd = {
+	.command = "errno_autotest",
+	.callback = test_errno,
+};
+REGISTER_TEST_COMMAND(errno_cmd);
diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c
index 0955b0a..45928fa 100644
--- a/app/test/test_func_reentrancy.c
+++ b/app/test/test_func_reentrancy.c
@@ -465,7 +465,7 @@ launch_test(struct test_case *pt_case)
 /**
  * Main entry of func_reentrancy test
  */
-int
+static int
 test_func_reentrancy(void)
 {
 	uint32_t case_id;
@@ -492,3 +492,9 @@ test_func_reentrancy(void)
 
 	return 0;
 }
+
+static struct test_command func_reentrancy_cmd = {
+	.command = "func_reentrancy_autotest",
+	.callback = test_func_reentrancy,
+};
+REGISTER_TEST_COMMAND(func_reentrancy_cmd);
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index 87de3c6..ae3238b 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -1330,7 +1330,8 @@ fail_jhash_3word:
 /*
  * Do all unit and performance tests.
  */
-int test_hash(void)
+static int
+test_hash(void)
 {
 	if (test_add_delete() < 0)
 		return -1;
@@ -1366,13 +1367,10 @@ int test_hash(void)
 
 	return 0;
 }
-#else /* RTE_LIBRTE_HASH */
-
-int
-test_hash(void)
-{
-	printf("The Hash library is not included in this build\n");
-	return 0;
-}
 
+static struct test_command hash_cmd = {
+	.command = "hash_autotest",
+	.callback = test_hash,
+};
+REGISTER_TEST_COMMAND(hash_cmd);
 #endif /* RTE_LIBRTE_HASH */
diff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c
index 1e9c16e..d3e9990 100644
--- a/app/test/test_hash_perf.c
+++ b/app/test/test_hash_perf.c
@@ -761,7 +761,8 @@ fbk_hash_perf_test(void)
 /*
  * Do all unit and performance tests.
  */
-int test_hash_perf(void)
+static int
+test_hash_perf(void)
 {
 	if (run_all_tbl_perf_tests() < 0)
 		return -1;
@@ -771,13 +772,10 @@ int test_hash_perf(void)
 		return -1;
 	return 0;
 }
-#else /* RTE_LIBRTE_HASH */
-
-int
-test_hash_perf(void)
-{
-	printf("The Hash library is not included in this build\n");
-	return 0;
-}
 
+static struct test_command hash_perf_cmd = {
+	.command = "hash_perf_autotest",
+	.callback = test_hash_perf,
+};
+REGISTER_TEST_COMMAND(hash_perf_cmd);
 #endif /* RTE_LIBRTE_HASH */
diff --git a/app/test/test_interrupts.c b/app/test/test_interrupts.c
index 4563e2b..61fdc56 100644
--- a/app/test/test_interrupts.c
+++ b/app/test/test_interrupts.c
@@ -395,7 +395,7 @@ test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type)
 /**
  * Main function of testing interrupt.
  */
-int
+static int
 test_interrupt(void)
 {
 	int ret = -1;
@@ -548,3 +548,8 @@ out:
 	return ret;
 }
 
+static struct test_command interrupt_cmd = {
+	.command = "interrupt_autotest",
+	.callback = test_interrupt,
+};
+REGISTER_TEST_COMMAND(interrupt_cmd);
diff --git a/app/test/test_ivshmem.c b/app/test/test_ivshmem.c
index 1404ada..e759939 100644
--- a/app/test/test_ivshmem.c
+++ b/app/test/test_ivshmem.c
@@ -431,12 +431,10 @@ test_ivshmem(void)
 
 	return -1;
 }
-#else /* RTE_LIBRTE_IVSHMEM */
 
-int
-test_ivshmem(void)
-{
-	printf("This binary was not compiled with IVSHMEM support!\n");
-	return 0;
-}
+static struct test_command ivshmem_cmd = {
+	.command = "ivshmem_autotest",
+	.callback = test_ivshmem,
+};
+REGISTER_TEST_COMMAND(ivshmem_cmd);
 #endif /* RTE_LIBRTE_IVSHMEM */
diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 962bfad..60683d2 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -488,7 +488,7 @@ fail_kni:
 	return ret;
 }
 
-int
+static int
 test_kni(void)
 {
 	int ret = -1;
@@ -680,13 +680,9 @@ fail:
 	return ret;
 }
 
-#else /* RTE_LIBRTE_KNI */
-
-int
-test_kni(void)
-{
-	printf("The KNI library is not included in this build\n");
-	return 0;
-}
-
+static struct test_command kni_cmd = {
+	.command = "kni_autotest",
+	.callback = test_kni,
+};
+REGISTER_TEST_COMMAND(kni_cmd);
 #endif /* RTE_LIBRTE_KNI */
diff --git a/app/test/test_kvargs.c b/app/test/test_kvargs.c
index c417ba2..b8f5e5c 100644
--- a/app/test/test_kvargs.c
+++ b/app/test/test_kvargs.c
@@ -223,7 +223,8 @@ static int test_invalid_kvargs(void)
 	return -1;
 }
 
-int test_kvargs(void)
+static int
+test_kvargs(void)
 {
 	printf("== test valid case ==\n");
 	if (test_valid_kvargs() < 0)
@@ -233,3 +234,9 @@ int test_kvargs(void)
 		return -1;
 	return 0;
 }
+
+static struct test_command kvargs_cmd = {
+	.command = "kvargs_autotest",
+	.callback = test_kvargs,
+};
+REGISTER_TEST_COMMAND(kvargs_cmd);
diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 5c1303e..db5b180 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -3810,8 +3810,14 @@ static struct unit_test_suite link_bonding_test_suite  = {
 };
 
 
-int
+static int
 test_link_bonding(void)
 {
 	return unit_test_suite_runner(&link_bonding_test_suite);
 }
+
+static struct test_command link_bonding_cmd = {
+	.command = "link_bonding_autotest",
+	.callback = test_link_bonding,
+};
+REGISTER_TEST_COMMAND(link_bonding_cmd);
diff --git a/app/test/test_logs.c b/app/test/test_logs.c
index 67daa5b..2063c74 100644
--- a/app/test/test_logs.c
+++ b/app/test/test_logs.c
@@ -59,7 +59,7 @@
  * - Send logs with different types and levels, some should not be displayed.
  */
 
-int
+static int
 test_logs(void)
 {
 	/* enable these logs type */
@@ -90,3 +90,9 @@ test_logs(void)
 
 	return 0;
 }
+
+static struct test_command logs_cmd = {
+	.command = "logs_autotest",
+	.callback = test_logs,
+};
+REGISTER_TEST_COMMAND(logs_cmd);
diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c
index 05f0a93..087d97a 100644
--- a/app/test/test_lpm.c
+++ b/app/test/test_lpm.c
@@ -1332,7 +1332,7 @@ perf_test(void)
  * Do all unit and performance tests.
  */
 
-int
+static int
 test_lpm(void)
 {
 	unsigned i;
@@ -1349,13 +1349,9 @@ test_lpm(void)
 	return global_status;
 }
 
-#else /* RTE_LIBRTE_LPM */
-
-int
-test_lpm(void)
-{
-	printf("The LPM library is not included in this build\n");
-	return 0;
-}
-
+static struct test_command lpm_cmd = {
+	.command = "lpm_autotest",
+	.callback = test_lpm,
+};
+REGISTER_TEST_COMMAND(lpm_cmd);
 #endif /* RTE_LIBRTE_LPM */
diff --git a/app/test/test_lpm6.c b/app/test/test_lpm6.c
index 982930b..bd99125 100644
--- a/app/test/test_lpm6.c
+++ b/app/test/test_lpm6.c
@@ -1902,7 +1902,7 @@ perf_test(void)
 /*
  * Do all unit and performance tests.
  */
-int
+static int
 test_lpm6(void)
 {
 	unsigned i;
@@ -1920,13 +1920,9 @@ test_lpm6(void)
 	return global_status;
 }
 
-#else /* RTE_LIBRTE_LPM */
-
-int
-test_lpm6(void)
-{
-        printf("The LPM library is not included in this build\n");
-        return 0;
-}
-
+static struct test_command lpm6_cmd = {
+	.command = "lpm6_autotest",
+	.callback = test_lpm6,
+};
+REGISTER_TEST_COMMAND(lpm6_cmd);
 #endif /* RTE_LIBRTE_LPM */
diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index 0817151..ee34ca3 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -924,7 +924,7 @@ test_alloc_socket(void)
 	return 0;
 }
 
-int
+static int
 test_malloc(void)
 {
 	unsigned lcore_id;
@@ -1045,3 +1045,9 @@ test_malloc(void)
 
 	return 0;
 }
+
+static struct test_command malloc_cmd = {
+	.command = "malloc_autotest",
+	.callback = test_malloc,
+};
+REGISTER_TEST_COMMAND(malloc_cmd);
diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 2b87521..21024e7 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -829,7 +829,7 @@ test_failing_mbuf_sanity_check(void)
 #endif
 
 
-int
+static int
 test_mbuf(void)
 {
 	RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != 64);
@@ -927,3 +927,9 @@ test_mbuf(void)
 	}
 	return 0;
 }
+
+static struct test_command mbuf_cmd = {
+	.command = "mbuf_autotest",
+	.callback = test_mbuf,
+};
+REGISTER_TEST_COMMAND(mbuf_cmd);
diff --git a/app/test/test_memcpy.c b/app/test/test_memcpy.c
index ee0b0da..56b8e1e 100644
--- a/app/test/test_memcpy.c
+++ b/app/test/test_memcpy.c
@@ -210,7 +210,7 @@ func_test(void)
 	return 0;
 }
 
-int
+static int
 test_memcpy(void)
 {
 	int ret;
@@ -223,3 +223,9 @@ test_memcpy(void)
 		return -1;
 	return 0;
 }
+
+static struct test_command memcpy_cmd = {
+	.command = "memcpy_autotest",
+	.callback = test_memcpy,
+};
+REGISTER_TEST_COMMAND(memcpy_cmd);
diff --git a/app/test/test_memcpy_perf.c b/app/test/test_memcpy_perf.c
index f6b95c9..7809610 100644
--- a/app/test/test_memcpy_perf.c
+++ b/app/test/test_memcpy_perf.c
@@ -278,7 +278,7 @@ perf_test(void)
 }
 
 
-int
+static int
 test_memcpy_perf(void)
 {
 	int ret;
@@ -288,3 +288,9 @@ test_memcpy_perf(void)
 		return -1;
 	return 0;
 }
+
+static struct test_command memcpy_perf_cmd = {
+	.command = "memcpy_perf_autotest",
+	.callback = test_memcpy_perf,
+};
+REGISTER_TEST_COMMAND(memcpy_perf_cmd);
diff --git a/app/test/test_memory.c b/app/test/test_memory.c
index 6c62de8..02ef3cf 100644
--- a/app/test/test_memory.c
+++ b/app/test/test_memory.c
@@ -51,7 +51,7 @@
  * - Try to read all memory; it should not segfault.
  */
 
-int
+static int
 test_memory(void)
 {
 	uint64_t s;
@@ -84,3 +84,9 @@ test_memory(void)
 
 	return 0;
 }
+
+static struct test_command memory_cmd = {
+	.command = "memory_autotest",
+	.callback = test_memory,
+};
+REGISTER_TEST_COMMAND(memory_cmd);
diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index a83b2ee..303d2b3 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -455,7 +455,7 @@ test_mempool_xmem_misc(void)
 	return (0);
 }
 
-int
+static int
 test_mempool(void)
 {
 	rte_atomic32_init(&synchro);
@@ -521,3 +521,9 @@ test_mempool(void)
 
 	return 0;
 }
+
+static struct test_command mempool_cmd = {
+	.command = "mempool_autotest",
+	.callback = test_mempool,
+};
+REGISTER_TEST_COMMAND(mempool_cmd);
diff --git a/app/test/test_mempool_perf.c b/app/test/test_mempool_perf.c
index d3141fe..57c0e5e 100644
--- a/app/test/test_mempool_perf.c
+++ b/app/test/test_mempool_perf.c
@@ -273,7 +273,7 @@ do_one_mempool_test(unsigned cores)
 	return 0;
 }
 
-int
+static int
 test_mempool_perf(void)
 {
 	rte_atomic32_init(&synchro);
@@ -329,3 +329,9 @@ test_mempool_perf(void)
 
 	return 0;
 }
+
+static struct test_command mempool_perf_cmd = {
+	.command = "mempool_perf_autotest",
+	.callback = test_mempool_perf,
+};
+REGISTER_TEST_COMMAND(mempool_perf_cmd);
diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c
index 42c7601..381f643 100644
--- a/app/test/test_memzone.c
+++ b/app/test/test_memzone.c
@@ -922,7 +922,7 @@ test_memzone_reserve_remainder(void)
 	return 0;
 }
 
-int
+static int
 test_memzone(void)
 {
 	const struct rte_memzone *memzone1;
@@ -1044,3 +1044,9 @@ test_memzone(void)
 
 	return 0;
 }
+
+static struct test_command memzone_cmd = {
+	.command = "memzone_autotest",
+	.callback = test_memzone,
+};
+REGISTER_TEST_COMMAND(memzone_cmd);
diff --git a/app/test/test_meter.c b/app/test/test_meter.c
index 226b231..215cbf8 100644
--- a/app/test/test_meter.c
+++ b/app/test/test_meter.c
@@ -471,7 +471,7 @@ tm_test_trtcm_color_aware_check(void)
 /**
  * test main entrance for library meter
  */
-int
+static int
 test_meter(void)
 {
 	if(tm_test_srtcm_config() != 0 )
@@ -496,12 +496,9 @@ test_meter(void)
 
 }
 
-#else /* RTE_LIBRTE_METER */
-
-int
-test_meter(void)
-{
-	printf("The meter library is not included in this build\n");
-	return 0;
-}
+static struct test_command meter_cmd = {
+	.command = "meter_autotest",
+	.callback = test_meter,
+};
+REGISTER_TEST_COMMAND(meter_cmd);
 #endif /* RTE_LIBRTE_METER */
diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c
index e739765..7579e20 100644
--- a/app/test/test_mp_secondary.c
+++ b/app/test/test_mp_secondary.c
@@ -265,16 +265,9 @@ test_mp_secondary(void)
 	return run_object_creation_tests();
 }
 
-#else
-
-/* Baremetal version
- * Multiprocess not applicable, so just return 0 always
- */
-int
-test_mp_secondary(void)
-{
-	printf("Multi-process not applicable for baremetal\n");
-	return 0;
-}
-
+static struct test_command multiprocess_cmd = {
+	.command = "multiprocess_autotest",
+	.callback = test_mp_secondary,
+};
+REGISTER_TEST_COMMAND(multiprocess_cmd);
 #endif
diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index 40095c6..e834c4d 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -195,3 +195,9 @@ test_pci(void)
 
 	return 0;
 }
+
+static struct test_command pci_cmd = {
+	.command = "pci_autotest",
+	.callback = test_pci,
+};
+REGISTER_TEST_COMMAND(pci_cmd);
diff --git a/app/test/test_per_lcore.c b/app/test/test_per_lcore.c
index 2241ed5..1a5a232 100644
--- a/app/test/test_per_lcore.c
+++ b/app/test/test_per_lcore.c
@@ -99,7 +99,7 @@ test_per_lcore_delay(__attribute__((unused)) void *arg)
 	return 0;
 }
 
-int
+static int
 test_per_lcore(void)
 {
 	unsigned lcore_id;
@@ -136,3 +136,9 @@ test_per_lcore(void)
 
 	return 0;
 }
+
+static struct test_command per_lcore_cmd = {
+	.command = "per_lcore_autotest",
+	.callback = test_per_lcore,
+};
+REGISTER_TEST_COMMAND(per_lcore_cmd);
diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
index 19ad0e9..6364495 100644
--- a/app/test/test_pmd_ring.c
+++ b/app/test/test_pmd_ring.c
@@ -405,7 +405,7 @@ test_pmd_ring_pair_create_attach(void)
 	return 0;
 }
 
-int
+static int
 test_pmd_ring(void)
 {
 	mp = rte_mempool_create("mbuf_pool", NB_MBUF,
@@ -445,13 +445,10 @@ test_pmd_ring(void)
 	return 0;
 }
 
-#else
-
-int
-test_pmd_ring(void)
-{
-	return 0;
-}
-
+static struct test_command ring_pmd_cmd = {
+	.command = "ring_pmd_autotest",
+	.callback = test_pmd_ring,
+};
+REGISTER_TEST_COMMAND(ring_pmd_cmd);
 #endif
 
diff --git a/app/test/test_power.c b/app/test/test_power.c
index 94c1cac..123b199 100644
--- a/app/test/test_power.c
+++ b/app/test/test_power.c
@@ -379,7 +379,7 @@ check_power_freq_min(void)
 	return 0;
 }
 
-int
+static int
 test_power(void)
 {
 	int ret = -1;
@@ -477,14 +477,10 @@ fail_all:
 	return -1;
 }
 
-#else /* RTE_LIBRTE_POWER */
-
-int
-test_power(void)
-{
-	printf("The power library is not included in this build\n");
-	return 0;
-}
-
+static struct test_command power_cmd = {
+	.command = "power_autotest",
+	.callback = test_power,
+};
+REGISTER_TEST_COMMAND(power_cmd);
 #endif /* RTE_LIBRTE_POWER */
 
diff --git a/app/test/test_prefetch.c b/app/test/test_prefetch.c
index 10039b7..f8615e2 100644
--- a/app/test/test_prefetch.c
+++ b/app/test/test_prefetch.c
@@ -46,7 +46,7 @@
  *   The test always return success.
  */
 
-int
+static int
 test_prefetch(void)
 {
 	int a;
@@ -57,3 +57,9 @@ test_prefetch(void)
 
 	return 0;
 }
+
+static struct test_command prefetch_cmd = {
+	.command = "prefetch_autotest",
+	.callback = test_prefetch,
+};
+REGISTER_TEST_COMMAND(prefetch_cmd);
diff --git a/app/test/test_red.c b/app/test/test_red.c
index bb62aba..7cf2221 100644
--- a/app/test/test_red.c
+++ b/app/test/test_red.c
@@ -1861,7 +1861,8 @@ test_invalid_parameters(void)
 	return 0;
 }
 
-int test_red(void)
+static int
+test_red(void)
 {
 	uint32_t num_tests = 0;
 	uint32_t num_pass = 0;
@@ -1883,13 +1884,9 @@ int test_red(void)
 	return (ret);
 }
 
-#else
-
-int
-test_red(void)
-{
-	printf("The SCHED library is not included in this build\n");
-	return 0;
-}
-
+static struct test_command red_cmd = {
+	.command = "red_autotest",
+	.callback = test_red,
+};
+REGISTER_TEST_COMMAND(red_cmd);
 #endif
diff --git a/app/test/test_ring.c b/app/test/test_ring.c
index be588f2..2cd8e77 100644
--- a/app/test/test_ring.c
+++ b/app/test/test_ring.c
@@ -1322,7 +1322,7 @@ fail_test:
 	return ret;
 }
 
-int
+static int
 test_ring(void)
 {
 	/* some more basic operations */
@@ -1392,3 +1392,9 @@ test_ring(void)
 
 	return 0;
 }
+
+static struct test_command ring_cmd = {
+	.command = "ring_autotest",
+	.callback = test_ring,
+};
+REGISTER_TEST_COMMAND(ring_cmd);
diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c
index 9ec6932..44dda4d 100644
--- a/app/test/test_ring_perf.c
+++ b/app/test/test_ring_perf.c
@@ -381,7 +381,7 @@ test_bulk_enqueue_dequeue(void)
 	}
 }
 
-int
+static int
 test_ring_perf(void)
 {
 	struct lcore_pair cores;
@@ -413,3 +413,9 @@ test_ring_perf(void)
 	}
 	return 0;
 }
+
+static struct test_command ring_perf_cmd = {
+	.command = "ring_perf_autotest",
+	.callback = test_ring_perf,
+};
+REGISTER_TEST_COMMAND(ring_perf_cmd);
diff --git a/app/test/test_rwlock.c b/app/test/test_rwlock.c
index 89fc594..c4e6e95 100644
--- a/app/test/test_rwlock.c
+++ b/app/test/test_rwlock.c
@@ -97,7 +97,7 @@ test_rwlock_per_core(__attribute__((unused)) void *arg)
 	return 0;
 }
 
-int
+static int
 test_rwlock(void)
 {
 	int i;
@@ -129,3 +129,9 @@ test_rwlock(void)
 
 	return 0;
 }
+
+static struct test_command rwlock_cmd = {
+	.command = "rwlock_autotest",
+	.callback = test_rwlock,
+};
+REGISTER_TEST_COMMAND(rwlock_cmd);
diff --git a/app/test/test_sched.c b/app/test/test_sched.c
index d9abb51..2cc9df5 100644
--- a/app/test/test_sched.c
+++ b/app/test/test_sched.c
@@ -155,7 +155,7 @@ prepare_pkt(struct rte_mbuf *mbuf)
 /**
  * test main entrance for library sched
  */
-int
+static int
 test_sched(void)
 {
 	struct rte_mempool *mp = NULL;
@@ -229,12 +229,9 @@ test_sched(void)
 	return 0;
 }
 
-#else /* RTE_LIBRTE_SCHED */
-
-int
-test_sched(void)
-{
-	printf("The Scheduler library is not included in this build\n");
-	return 0;
-}
+static struct test_command sched_cmd = {
+	.command = "sched_autotest",
+	.callback = test_sched,
+};
+REGISTER_TEST_COMMAND(sched_cmd);
 #endif /* RTE_LIBRTE_SCHED */
diff --git a/app/test/test_spinlock.c b/app/test/test_spinlock.c
index 9b45d8e..c95b0c0 100644
--- a/app/test/test_spinlock.c
+++ b/app/test/test_spinlock.c
@@ -225,7 +225,7 @@ test_spinlock_try(__attribute__((unused)) void *arg)
  * Test rte_eal_get_lcore_state() in addition to spinlocks
  * as we have "waiting" then "running" lcores.
  */
-int
+static int
 test_spinlock(void)
 {
 	int ret = 0;
@@ -333,3 +333,9 @@ test_spinlock(void)
 
 	return ret;
 }
+
+static struct test_command spinlock_cmd = {
+	.command = "spinlock_autotest",
+	.callback = test_spinlock,
+};
+REGISTER_TEST_COMMAND(spinlock_cmd);
diff --git a/app/test/test_string_fns.c b/app/test/test_string_fns.c
index 223797c..29bfe5b 100644
--- a/app/test/test_string_fns.c
+++ b/app/test/test_string_fns.c
@@ -291,7 +291,7 @@ test_rte_strsplit(void)
 	return 0;
 }
 
-int
+static int
 test_string_fns(void)
 {
 	if (test_rte_snprintf() < 0 ||
@@ -299,3 +299,9 @@ test_string_fns(void)
 		return -1;
 	return 0;
 }
+
+static struct test_command string_cmd = {
+	.command = "string_autotest",
+	.callback = test_string_fns,
+};
+REGISTER_TEST_COMMAND(string_cmd);
diff --git a/app/test/test_table.c b/app/test/test_table.c
index 970d15c..33e2efc 100644
--- a/app/test/test_table.c
+++ b/app/test/test_table.c
@@ -32,17 +32,7 @@
  */
 
 
-#ifndef RTE_LIBRTE_TABLE
-
-#include "test.h"
-
-int
-test_table(void)
-{
-	return 0;
-}
-
-#else
+#ifdef RTE_LIBRTE_TABLE
 
 #include <rte_byteorder.h>
 #include <rte_hexdump.h>
@@ -156,7 +146,7 @@ app_init_rings(void)
 
 }
 
-int
+static int
 test_table(void)
 {
 	int status, failures;
@@ -217,4 +207,9 @@ test_table(void)
 	return 0;
 }
 
+static struct test_command table_cmd = {
+	.command = "table_autotest",
+	.callback = test_table,
+};
+REGISTER_TEST_COMMAND(table_cmd);
 #endif
diff --git a/app/test/test_table.h b/app/test/test_table.h
index afea738..40e50db 100644
--- a/app/test/test_table.h
+++ b/app/test/test_table.h
@@ -126,7 +126,6 @@
 } while (0)
 
 /* Function definitions */
-int test_table(void);
 uint64_t pipeline_test_hash(
 	void *key,
 	__attribute__((unused)) uint32_t key_size,
diff --git a/app/test/test_tailq.c b/app/test/test_tailq.c
index c9b53ee..4d32c6f 100644
--- a/app/test/test_tailq.c
+++ b/app/test/test_tailq.c
@@ -153,7 +153,7 @@ test_tailq_deprecated(void)
 	return 0;
 }
 
-int
+static int
 test_tailq(void)
 {
 	int ret = 0;
@@ -162,3 +162,9 @@ test_tailq(void)
 	ret |= test_tailq_deprecated();
 	return ret;
 }
+
+static struct test_command tailq_cmd = {
+	.command = "tailq_autotest",
+	.callback = test_tailq,
+};
+REGISTER_TEST_COMMAND(tailq_cmd);
diff --git a/app/test/test_timer.c b/app/test/test_timer.c
index 57b722c..ec826c0 100644
--- a/app/test/test_timer.c
+++ b/app/test/test_timer.c
@@ -457,7 +457,7 @@ timer_sanity_check(void)
 	return 0;
 }
 
-int
+static int
 test_timer(void)
 {
 	unsigned i;
@@ -520,12 +520,9 @@ test_timer(void)
 	return 0;
 }
 
-#else
-
-int
-test_timer(void)
-{
-	return 0;
-}
-
+static struct test_command timer_cmd = {
+	.command = "timer_autotest",
+	.callback = test_timer,
+};
+REGISTER_TEST_COMMAND(timer_cmd);
 #endif
diff --git a/app/test/test_timer_perf.c b/app/test/test_timer_perf.c
index 83bd45d..da92473 100644
--- a/app/test/test_timer_perf.c
+++ b/app/test/test_timer_perf.c
@@ -62,7 +62,7 @@ timer_cb(struct rte_timer *t __rte_unused, void *param __rte_unused)
 #define do_delay() rte_pause()
 #endif
 
-int
+static int
 test_timer_perf(void)
 {
 	unsigned iterations = 100;
@@ -159,12 +159,9 @@ test_timer_perf(void)
 	return 0;
 }
 
-#else
-
-int
-test_timer_perf(void)
-{
-	return 0;
-}
-
+static struct test_command timer_perf_cmd = {
+	.command = "timer_perf_autotest",
+	.callback = test_timer_perf,
+};
+REGISTER_TEST_COMMAND(timer_perf_cmd);
 #endif
diff --git a/app/test/test_version.c b/app/test/test_version.c
index ac6ffa0..f66827d 100644
--- a/app/test/test_version.c
+++ b/app/test/test_version.c
@@ -41,7 +41,7 @@
 #include "test.h"
 
 
-int
+static int
 test_version(void)
 {
 	const char *version = rte_version();
@@ -53,3 +53,9 @@ test_version(void)
 		return -1;
 	return 0;
 }
+
+static struct test_command version_cmd = {
+	.command = "version_autotest",
+	.callback = test_version,
+};
+REGISTER_TEST_COMMAND(version_cmd);
-- 
1.7.10.4

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

* [dpdk-dev] [PATCH v2 6/7] app/test: no more builtin commands
  2014-08-18 11:29 [dpdk-dev] [PATCH v2 0/7] fix build errors David Marchand
                   ` (4 preceding siblings ...)
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 5/7] app/test: convert all tests to register system David Marchand
@ 2014-08-18 11:29 ` David Marchand
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 7/7] app/test: only build what has been selected in config David Marchand
  2014-08-18 12:57 ` [dpdk-dev] [PATCH v2 0/7] fix build errors Bruce Richardson
  7 siblings, 0 replies; 10+ messages in thread
From: David Marchand @ 2014-08-18 11:29 UTC (permalink / raw)
  To: dev

The builtin commands list is now empty, we can remove it.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 app/test/commands.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/commands.c b/app/test/commands.c
index 0640ac9..b7c6ee0 100644
--- a/app/test/commands.c
+++ b/app/test/commands.c
@@ -324,9 +324,8 @@ cmdline_parse_ctx_t main_ctx[] = {
 int commands_init(void)
 {
 	struct test_command *t;
-	char builtin_commands[] = "";
 	char *commands, *ptr;
-	int commands_len = strlen(builtin_commands) + 1;
+	int commands_len = 0;
 
 	TAILQ_FOREACH(t, &commands_list, next) {
 		commands_len += strlen(t->command) + 1;
@@ -340,7 +339,8 @@ int commands_init(void)
 	TAILQ_FOREACH(t, &commands_list, next) {
 		ptr += sprintf(ptr, "%s#", t->command);
 	}
-	ptr += sprintf(ptr, "%s", builtin_commands);
+	ptr--;
+	ptr[0] = '\0';
 
 	cmd_autotest_autotest.string_data.str = commands;
 	return 0;
-- 
1.7.10.4

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

* [dpdk-dev] [PATCH v2 7/7] app/test: only build what has been selected in config
  2014-08-18 11:29 [dpdk-dev] [PATCH v2 0/7] fix build errors David Marchand
                   ` (5 preceding siblings ...)
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 6/7] app/test: no more builtin commands David Marchand
@ 2014-08-18 11:29 ` David Marchand
  2014-08-18 12:57 ` [dpdk-dev] [PATCH v2 0/7] fix build errors Bruce Richardson
  7 siblings, 0 replies; 10+ messages in thread
From: David Marchand @ 2014-08-18 11:29 UTC (permalink / raw)
  To: dev

Avoid building tests if their counterparts are not selected in config.
This has the nice side effect of fixing build errors when disabling parts of
the dpdk.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 app/test/Makefile                |   61 ++++++++++++++++++++++++++------------
 app/test/test_acl.c              |    3 --
 app/test/test_cmdline.c          |    2 --
 app/test/test_distributor.c      |    2 --
 app/test/test_distributor_perf.c |    2 --
 app/test/test_eal_flags.c        |    2 --
 app/test/test_eal_fs.c           |    2 --
 app/test/test_hash.c             |    3 --
 app/test/test_hash_perf.c        |    3 --
 app/test/test_ivshmem.c          |    3 --
 app/test/test_kni.c              |    2 --
 app/test/test_lpm.c              |    3 --
 app/test/test_lpm6.c             |    3 --
 app/test/test_meter.c            |    3 --
 app/test/test_mp_secondary.c     |    2 --
 app/test/test_pmd_ring.c         |    4 ---
 app/test/test_power.c            |    4 ---
 app/test/test_red.c              |    3 --
 app/test/test_sched.c            |    3 --
 app/test/test_table.c            |    4 ---
 app/test/test_table_acl.c        |    4 ---
 app/test/test_table_combined.c   |    3 --
 app/test/test_table_pipeline.c   |    8 -----
 app/test/test_table_ports.c      |    4 ---
 app/test/test_table_tables.c     |    4 ---
 app/test/test_timer.c            |    2 --
 app/test/test_timer_perf.c       |    2 --
 27 files changed, 42 insertions(+), 99 deletions(-)

diff --git a/app/test/Makefile b/app/test/Makefile
index 445405a..37a3772 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -53,39 +53,57 @@ SRCS-y += test_cycles.c
 SRCS-y += test_spinlock.c
 SRCS-y += test_memory.c
 SRCS-y += test_memzone.c
+
 SRCS-y += test_ring.c
+SRCS-y += test_ring_perf.c
+
+ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
 SRCS-y += test_table.c
-SRCS-y += test_table_pipeline.c
+SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += test_table_pipeline.c
 SRCS-y += test_table_tables.c
 SRCS-y += test_table_ports.c
 SRCS-y += test_table_combined.c
-SRCS-y += test_table_acl.c
-SRCS-y += test_ring_perf.c
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_table_acl.c
+endif
+
 SRCS-y += test_rwlock.c
-SRCS-y += test_timer.c
+
+SRCS-$(CONFIG_RTE_LIBRTE_TIMER) += test_timer.c
+SRCS-$(CONFIG_RTE_LIBRTE_TIMER) += test_timer_perf.c
+
 SRCS-y += test_mempool.c
 SRCS-y += test_mempool_perf.c
+
 SRCS-y += test_mbuf.c
 SRCS-y += test_logs.c
+
 SRCS-y += test_memcpy.c
 SRCS-y += test_memcpy_perf.c
-SRCS-y += test_hash.c
-SRCS-y += test_hash_perf.c
-SRCS-y += test_lpm.c
-SRCS-y += test_lpm6.c
+
+SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash.c
+SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_perf.c
+
+SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm.c
+SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm6.c
+
 SRCS-y += test_debug.c
 SRCS-y += test_errno.c
 SRCS-y += test_tailq.c
 SRCS-y += test_string_fns.c
-SRCS-y += test_mp_secondary.c
 SRCS-y += test_cpuflags.c
+
+ifeq ($(CONFIG_RTE_EXEC_ENV_BAREMETAL),)
+SRCS-y += test_mp_secondary.c
 SRCS-y += test_eal_flags.c
+SRCS-y += test_eal_fs.c
+endif
+
 SRCS-y += test_alarm.c
 SRCS-y += test_interrupts.c
 SRCS-y += test_version.c
-SRCS-y += test_eal_fs.c
 SRCS-y += test_func_reentrancy.c
-SRCS-y += test_cmdline.c
+
+SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_num.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_etheraddr.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_portlist.c
@@ -93,16 +111,21 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_ipaddr.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_cirbuf.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_string.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_lib.c
+
+ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
 SRCS-y += test_red.c
-SRCS-y += test_sched.c
-SRCS-y += test_meter.c
-SRCS-y += test_kni.c
-SRCS-y += test_power.c
+SRCS-$(CONFIG_RTE_ARCH_X86_64) += test_sched.c
+endif
+
+SRCS-$(CONFIG_RTE_LIBRTE_METER) += test_meter.c
+SRCS-$(CONFIG_RTE_LIBRTE_KNI) += test_kni.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) += test_power.c
 SRCS-y += test_common.c
-SRCS-y += test_timer_perf.c
-SRCS-y += test_ivshmem.c
-SRCS-y += test_distributor.c
-SRCS-y += test_distributor_perf.c
+SRCS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += test_ivshmem.c
+
+SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += test_distributor.c
+SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += test_distributor_perf.c
+
 SRCS-y += test_devargs.c
 SRCS-y += virtual_pmd.c
 SRCS-y += packet_burst_generator.c
diff --git a/app/test/test_acl.c b/app/test/test_acl.c
index 4e7b470..c6b3f86 100644
--- a/app/test/test_acl.c
+++ b/app/test/test_acl.c
@@ -36,8 +36,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_ACL
-
 #include <rte_string_fns.h>
 #include <rte_mbuf.h>
 #include <rte_byteorder.h>
@@ -934,4 +932,3 @@ static struct test_command acl_cmd = {
 	.callback = test_acl,
 };
 REGISTER_TEST_COMMAND(acl_cmd);
-#endif /* RTE_LIBRTE_ACL */
diff --git a/app/test/test_cmdline.c b/app/test/test_cmdline.c
index 9b8bd5c..2b5840f 100644
--- a/app/test/test_cmdline.c
+++ b/app/test/test_cmdline.c
@@ -36,7 +36,6 @@
 #include "test.h"
 #include "test_cmdline.h"
 
-#ifdef RTE_LIBRTE_CMDLINE
 static int
 test_cmdline(void)
 {
@@ -95,4 +94,3 @@ static struct test_command cmdline_cmd = {
 	.callback = test_cmdline,
 };
 REGISTER_TEST_COMMAND(cmdline_cmd);
-#endif
diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index b29bef8..eca974d 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -33,7 +33,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_DISTRIBUTOR
 #include <unistd.h>
 #include <string.h>
 #include <rte_cycles.h>
@@ -586,4 +585,3 @@ static struct test_command distributor_cmd = {
 	.callback = test_distributor,
 };
 REGISTER_TEST_COMMAND(distributor_cmd);
-#endif
diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c
index 8a6b855..849387d 100644
--- a/app/test/test_distributor_perf.c
+++ b/app/test/test_distributor_perf.c
@@ -33,7 +33,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_DISTRIBUTOR
 #include <unistd.h>
 #include <string.h>
 #include <rte_cycles.h>
@@ -266,4 +265,3 @@ static struct test_command distributor_perf_cmd = {
 	.callback = test_distributor_perf,
 };
 REGISTER_TEST_COMMAND(distributor_perf_cmd);
-#endif
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 2d81764..21e6cca 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -35,7 +35,6 @@
 
 #include "test.h"
 
-#ifndef RTE_EXEC_ENV_BAREMETAL
 #include <string.h>
 #include <stdarg.h>
 #include <libgen.h>
@@ -1288,4 +1287,3 @@ static struct test_command eal_flags_cmd = {
 	.callback = test_eal_flags,
 };
 REGISTER_TEST_COMMAND(eal_flags_cmd);
-#endif
diff --git a/app/test/test_eal_fs.c b/app/test/test_eal_fs.c
index 8d4edc1..cd41b3e 100644
--- a/app/test/test_eal_fs.c
+++ b/app/test/test_eal_fs.c
@@ -32,7 +32,6 @@
  */
 
 #include "test.h"
-#ifndef RTE_EXEC_ENV_BAREMETAL
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -209,4 +208,3 @@ static struct test_command eal_fs_cmd = {
 	.callback = test_eal_fs,
 };
 REGISTER_TEST_COMMAND(eal_fs_cmd);
-#endif
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index ae3238b..178ec3f 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -52,8 +52,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_HASH
-
 #include <rte_hash.h>
 #include <rte_fbk_hash.h>
 #include <rte_jhash.h>
@@ -1373,4 +1371,3 @@ static struct test_command hash_cmd = {
 	.callback = test_hash,
 };
 REGISTER_TEST_COMMAND(hash_cmd);
-#endif /* RTE_LIBRTE_HASH */
diff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c
index d3e9990..7bb7016 100644
--- a/app/test/test_hash_perf.c
+++ b/app/test/test_hash_perf.c
@@ -53,8 +53,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_HASH
-
 #include <rte_hash.h>
 #include <rte_fbk_hash.h>
 #include <rte_jhash.h>
@@ -778,4 +776,3 @@ static struct test_command hash_perf_cmd = {
 	.callback = test_hash_perf,
 };
 REGISTER_TEST_COMMAND(hash_perf_cmd);
-#endif /* RTE_LIBRTE_HASH */
diff --git a/app/test/test_ivshmem.c b/app/test/test_ivshmem.c
index e759939..2996a86 100644
--- a/app/test/test_ivshmem.c
+++ b/app/test/test_ivshmem.c
@@ -43,8 +43,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_IVSHMEM
-
 #include <rte_common.h>
 #include <rte_ivshmem.h>
 #include <rte_string_fns.h>
@@ -437,4 +435,3 @@ static struct test_command ivshmem_cmd = {
 	.callback = test_ivshmem,
 };
 REGISTER_TEST_COMMAND(ivshmem_cmd);
-#endif /* RTE_LIBRTE_IVSHMEM */
diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 60683d2..2860bf3 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -39,7 +39,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_KNI
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
@@ -685,4 +684,3 @@ static struct test_command kni_cmd = {
 	.callback = test_kni,
 };
 REGISTER_TEST_COMMAND(kni_cmd);
-#endif /* RTE_LIBRTE_KNI */
diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c
index 087d97a..6d8823e 100644
--- a/app/test/test_lpm.c
+++ b/app/test/test_lpm.c
@@ -47,8 +47,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_LPM
-
 #include "rte_lpm.h"
 #include "test_lpm_routes.h"
 
@@ -1354,4 +1352,3 @@ static struct test_command lpm_cmd = {
 	.callback = test_lpm,
 };
 REGISTER_TEST_COMMAND(lpm_cmd);
-#endif /* RTE_LIBRTE_LPM */
diff --git a/app/test/test_lpm6.c b/app/test/test_lpm6.c
index bd99125..1f88d7a 100644
--- a/app/test/test_lpm6.c
+++ b/app/test/test_lpm6.c
@@ -41,8 +41,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_LPM
-
 #include <rte_common.h>
 #include <rte_cycles.h>
 #include <rte_memory.h>
@@ -1925,4 +1923,3 @@ static struct test_command lpm6_cmd = {
 	.callback = test_lpm6,
 };
 REGISTER_TEST_COMMAND(lpm6_cmd);
-#endif /* RTE_LIBRTE_LPM */
diff --git a/app/test/test_meter.c b/app/test/test_meter.c
index 215cbf8..bc76391 100644
--- a/app/test/test_meter.c
+++ b/app/test/test_meter.c
@@ -39,8 +39,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_METER
-
 #include <rte_cycles.h>
 #include <rte_meter.h>
 
@@ -501,4 +499,3 @@ static struct test_command meter_cmd = {
 	.callback = test_meter,
 };
 REGISTER_TEST_COMMAND(meter_cmd);
-#endif /* RTE_LIBRTE_METER */
diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c
index 7579e20..95a12e2 100644
--- a/app/test/test_mp_secondary.c
+++ b/app/test/test_mp_secondary.c
@@ -35,7 +35,6 @@
 
 #include "test.h"
 
-#ifndef RTE_EXEC_ENV_BAREMETAL
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -270,4 +269,3 @@ static struct test_command multiprocess_cmd = {
 	.callback = test_mp_secondary,
 };
 REGISTER_TEST_COMMAND(multiprocess_cmd);
-#endif
diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
index 6364495..7490112 100644
--- a/app/test/test_pmd_ring.c
+++ b/app/test/test_pmd_ring.c
@@ -32,8 +32,6 @@
  */
 #include "test.h"
 
-#ifdef RTE_LIBRTE_PMD_RING
-
 #include <stdio.h>
 
 #include <rte_eth_ring.h>
@@ -450,5 +448,3 @@ static struct test_command ring_pmd_cmd = {
 	.callback = test_pmd_ring,
 };
 REGISTER_TEST_COMMAND(ring_pmd_cmd);
-#endif
-
diff --git a/app/test/test_power.c b/app/test/test_power.c
index 123b199..d9eb420 100644
--- a/app/test/test_power.c
+++ b/app/test/test_power.c
@@ -39,8 +39,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_POWER
-
 #include <rte_power.h>
 
 #define TEST_POWER_LCORE_ID      2U
@@ -482,5 +480,3 @@ static struct test_command power_cmd = {
 	.callback = test_power,
 };
 REGISTER_TEST_COMMAND(power_cmd);
-#endif /* RTE_LIBRTE_POWER */
-
diff --git a/app/test/test_red.c b/app/test/test_red.c
index 7cf2221..262df72 100644
--- a/app/test/test_red.c
+++ b/app/test/test_red.c
@@ -43,8 +43,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_SCHED
-
 #include <rte_red.h>
 
 #ifdef __INTEL_COMPILER
@@ -1889,4 +1887,3 @@ static struct test_command red_cmd = {
 	.callback = test_red,
 };
 REGISTER_TEST_COMMAND(red_cmd);
-#endif
diff --git a/app/test/test_sched.c b/app/test/test_sched.c
index 2cc9df5..ce47084 100644
--- a/app/test/test_sched.c
+++ b/app/test/test_sched.c
@@ -39,8 +39,6 @@
 
 #include "test.h"
 
-#if defined(RTE_LIBRTE_SCHED) && defined(RTE_ARCH_X86_64)
-
 #include <rte_cycles.h>
 #include <rte_ether.h>
 #include <rte_ip.h>
@@ -234,4 +232,3 @@ static struct test_command sched_cmd = {
 	.callback = test_sched,
 };
 REGISTER_TEST_COMMAND(sched_cmd);
-#endif /* RTE_LIBRTE_SCHED */
diff --git a/app/test/test_table.c b/app/test/test_table.c
index 33e2efc..c3093cc 100644
--- a/app/test/test_table.c
+++ b/app/test/test_table.c
@@ -31,9 +31,6 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
-#ifdef RTE_LIBRTE_TABLE
-
 #include <rte_byteorder.h>
 #include <rte_hexdump.h>
 #include <rte_string_fns.h>
@@ -212,4 +209,3 @@ static struct test_command table_cmd = {
 	.callback = test_table,
 };
 REGISTER_TEST_COMMAND(table_cmd);
-#endif
diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c
index 5bcc8b8..dda0570 100644
--- a/app/test/test_table_acl.c
+++ b/app/test/test_table_acl.c
@@ -31,8 +31,6 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifdef RTE_LIBRTE_ACL
-
 #include <rte_hexdump.h>
 #include "test_table.h"
 #include "test_table_acl.h"
@@ -587,5 +585,3 @@ test_table_ACL(void)
 
 	return 0;
 }
-
-#endif
diff --git a/app/test/test_table_combined.c b/app/test/test_table_combined.c
index 3380ff1..dd09da5 100644
--- a/app/test/test_table_combined.c
+++ b/app/test/test_table_combined.c
@@ -31,7 +31,6 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifdef RTE_LIBRTE_TABLE
 #include <string.h>
 #include "test_table_combined.h"
 #include "test_table.h"
@@ -780,5 +779,3 @@ test_table_hash32ext(void)
 
 	return 0;
 }
-
-#endif
diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c
index 35644a6..70b1015 100644
--- a/app/test/test_table_pipeline.c
+++ b/app/test/test_table_pipeline.c
@@ -31,12 +31,6 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef RTE_LIBRTE_PIPELINE
-
-#include "test.h"
-
-#else
-
 #include <string.h>
 #include <rte_pipeline.h>
 #include <rte_log.h>
@@ -599,5 +593,3 @@ test_table_pipeline(void)
 
 	return 0;
 }
-
-#endif
diff --git a/app/test/test_table_ports.c b/app/test/test_table_ports.c
index e9d45b0..2532367 100644
--- a/app/test/test_table_ports.c
+++ b/app/test/test_table_ports.c
@@ -31,8 +31,6 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifdef RTE_LIBRTE_TABLE
-
 #include "test_table_ports.h"
 #include "test_table.h"
 
@@ -220,5 +218,3 @@ test_port_ring_writer(void)
 
 	return 0;
 }
-
-#endif
diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c
index da8338c..14add77 100644
--- a/app/test/test_table_tables.c
+++ b/app/test/test_table_tables.c
@@ -31,8 +31,6 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifdef RTE_LIBRTE_TABLE
-
 #include <string.h>
 #include <rte_byteorder.h>
 #include <rte_table_lpm_ipv6.h>
@@ -903,5 +901,3 @@ test_table_hash_ext(void)
 
 	return 0;
 }
-
-#endif
diff --git a/app/test/test_timer.c b/app/test/test_timer.c
index ec826c0..4b4800b 100644
--- a/app/test/test_timer.c
+++ b/app/test/test_timer.c
@@ -33,7 +33,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_TIMER
 /*
  * Timer
  * =====
@@ -525,4 +524,3 @@ static struct test_command timer_cmd = {
 	.callback = test_timer,
 };
 REGISTER_TEST_COMMAND(timer_cmd);
-#endif
diff --git a/app/test/test_timer_perf.c b/app/test/test_timer_perf.c
index da92473..3f7ddd3 100644
--- a/app/test/test_timer_perf.c
+++ b/app/test/test_timer_perf.c
@@ -33,7 +33,6 @@
 
 #include "test.h"
 
-#ifdef RTE_LIBRTE_TIMER
 #include <stdio.h>
 #include <unistd.h>
 #include <inttypes.h>
@@ -164,4 +163,3 @@ static struct test_command timer_perf_cmd = {
 	.callback = test_timer_perf,
 };
 REGISTER_TEST_COMMAND(timer_perf_cmd);
-#endif
-- 
1.7.10.4

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

* Re: [dpdk-dev] [PATCH v2 0/7] fix build errors
  2014-08-18 11:29 [dpdk-dev] [PATCH v2 0/7] fix build errors David Marchand
                   ` (6 preceding siblings ...)
  2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 7/7] app/test: only build what has been selected in config David Marchand
@ 2014-08-18 12:57 ` Bruce Richardson
  2014-08-26 15:58   ` Thomas Monjalon
  7 siblings, 1 reply; 10+ messages in thread
From: Bruce Richardson @ 2014-08-18 12:57 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Mon, Aug 18, 2014 at 01:29:18PM +0200, David Marchand wrote:
> This patch series resolves build errors I encountered after disabling some parts
> of the dpdk.
> 
> - simplified app/*/Makefile,
> - fixed some build error when disabling refcnt,
> - removed dead code (reference to pm_autotest),
> - reworked all the tests from app/test to use a dynamic register mechanism
>   (this makes it easier to enable/disable them),
> - reworked app/test Makefile to only enable the relevant tests.
> 
> Changes since v1:
> - fixed typo in first patch (RTE_CONFIG.. in app/test/Makefile)
> 
> -- 
> David Marchand
>
This looks like a good idea to me, simplifies the code and the boiler-plate work to be done when adding new tests.

Series Acked-by: Bruce Richardson <bruce.richardson@intel.com>
 

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

* Re: [dpdk-dev] [PATCH v2 0/7] fix build errors
  2014-08-18 12:57 ` [dpdk-dev] [PATCH v2 0/7] fix build errors Bruce Richardson
@ 2014-08-26 15:58   ` Thomas Monjalon
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2014-08-26 15:58 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

> > This patch series resolves build errors I encountered after disabling some parts
> > of the dpdk.
> > 
> > - simplified app/*/Makefile,
> > - fixed some build error when disabling refcnt,
> > - removed dead code (reference to pm_autotest),
> > - reworked all the tests from app/test to use a dynamic register mechanism
> >   (this makes it easier to enable/disable them),
> > - reworked app/test Makefile to only enable the relevant tests.
> > 
> > Changes since v1:
> > - fixed typo in first patch (RTE_CONFIG.. in app/test/Makefile)
> > 
> >
> This looks like a good idea to me, simplifies the code and the boiler-plate work to be done when adding new tests.
> 
> Series Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied for version 1.7.1.

Glad to see some cleanup.
Thanks
-- 
Thomas

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

end of thread, other threads:[~2014-08-26 15:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-18 11:29 [dpdk-dev] [PATCH v2 0/7] fix build errors David Marchand
2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 1/7] app: simplify makefiles David Marchand
2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 2/7] app/test: use accessor to set refcnt field David Marchand
2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 3/7] app/test: remove pm_autotest David Marchand
2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 4/7] app/test: introduce dynamic commands list David Marchand
2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 5/7] app/test: convert all tests to register system David Marchand
2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 6/7] app/test: no more builtin commands David Marchand
2014-08-18 11:29 ` [dpdk-dev] [PATCH v2 7/7] app/test: only build what has been selected in config David Marchand
2014-08-18 12:57 ` [dpdk-dev] [PATCH v2 0/7] fix build errors Bruce Richardson
2014-08-26 15:58   ` Thomas Monjalon

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).