app/test: only build what has been selected in config
[dpdk.git] / app / test / test_table.c
index 7e2e781..c3093cc 100644 (file)
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
-#ifndef RTE_LIBRTE_TABLE
-
-#include "test.h"
-
-int
-test_table(void)
-{
-       return 0;
-}
-
-#else
-
 #include <rte_byteorder.h>
 #include <rte_hexdump.h>
 #include <rte_string_fns.h>
@@ -125,7 +112,7 @@ app_init_rings(void)
        for (i = 0; i < N_PORTS; i++) {
                char name[32];
 
-               rte_snprintf(name, sizeof(name), "app_ring_rx_%u", i);
+               snprintf(name, sizeof(name), "app_ring_rx_%u", i);
                rings_rx[i] = rte_ring_lookup(name);
                if (rings_rx[i] == NULL) {
                        rings_rx[i] = rte_ring_create(
@@ -141,7 +128,7 @@ app_init_rings(void)
        for (i = 0; i < N_PORTS; i++) {
                char name[32];
 
-               rte_snprintf(name, sizeof(name), "app_ring_tx_%u", i);
+               snprintf(name, sizeof(name), "app_ring_tx_%u", i);
                rings_tx[i] = rte_ring_lookup(name);
                if (rings_tx[i] == NULL) {
                        rings_tx[i] = rte_ring_create(
@@ -156,7 +143,7 @@ app_init_rings(void)
 
 }
 
-int
+static int
 test_table(void)
 {
        int status, failures;
@@ -217,4 +204,8 @@ test_table(void)
        return 0;
 }
 
-#endif
+static struct test_command table_cmd = {
+       .command = "table_autotest",
+       .callback = test_table,
+};
+REGISTER_TEST_COMMAND(table_cmd);