app: fix build when some libs are disabled

Signed-off-by: Intel
This commit is contained in:
Intel 2013-06-03 00:00:00 +00:00 committed by Thomas Monjalon
parent ac3fb3019c
commit 1c14c98d7b
3 changed files with 30 additions and 4 deletions

View File

@ -58,10 +58,17 @@
#include <rte_mempool.h>
#include <rte_spinlock.h>
#include <rte_malloc.h>
#ifdef RTE_LIBRTE_HASH
#include <rte_hash.h>
#include <rte_fbk_hash.h>
#include <rte_jhash.h>
#endif /* RTE_LIBRTE_HASH */
#ifdef RTE_LIBRTE_LPM
#include <rte_lpm.h>
#endif /* RTE_LIBRTE_LPM */
#include <rte_string_fns.h>
#include <cmdline_parse.h>
@ -197,6 +204,7 @@ mempool_create_lookup(__attribute__((unused)) void *arg)
return 0;
}
#ifdef RTE_LIBRTE_HASH
static void
hash_clean(unsigned lcore_id)
{
@ -333,7 +341,9 @@ fbk_create_free(__attribute__((unused)) void *arg)
return 0;
}
#endif /* RTE_LIBRTE_HASH */
#ifdef RTE_LIBRTE_LPM
static void
lpm_clean(unsigned lcore_id)
{
@ -389,6 +399,7 @@ lpm_create_free(__attribute__((unused)) void *arg)
return 0;
}
#endif /* RTE_LIBRTE_LPM */
struct test_case{
case_func_t func;
@ -402,9 +413,13 @@ struct test_case test_cases[] = {
{ test_eal_init_once, NULL, NULL, "eal init once" },
{ ring_create_lookup, NULL, NULL, "ring create/lookup" },
{ mempool_create_lookup, NULL, NULL, "mempool create/lookup" },
#ifdef RTE_LIBRTE_HASH
{ hash_create_free, NULL, hash_clean, "hash create/free" },
{ fbk_create_free, NULL, fbk_clean, "fbk create/free" },
#endif /* RTE_LIBRTE_HASH */
#ifdef RTE_LIBRTE_LPM
{ lpm_create_free, NULL, lpm_clean, "lpm create/free" },
#endif /* RTE_LIBRTE_LPM */
};
/**

View File

@ -47,13 +47,13 @@
#include <rte_ip.h>
#include <time.h>
#include "test.h"
#ifdef RTE_LIBRTE_LPM
#include "rte_lpm.h"
#include "test_lpm_routes.h"
#include "test.h"
#define TEST_LPM_ASSERT(cond) do { \
if (!(cond)) { \
printf("Error at line %d: \n", __LINE__); \
@ -1281,7 +1281,7 @@ test_lpm(void)
return global_status;
}
#else
#else /* RTE_LIBRTE_LPM */
int
test_lpm(void)
@ -1290,4 +1290,4 @@ test_lpm(void)
return 0;
}
#endif
#endif /* RTE_LIBRTE_LPM */

View File

@ -70,9 +70,16 @@
#include <rte_debug.h>
#include <rte_log.h>
#include <rte_mempool.h>
#ifdef RTE_LIBRTE_HASH
#include <rte_hash.h>
#include <rte_fbk_hash.h>
#endif /* RTE_LIBRTE_HASH */
#ifdef RTE_LIBRTE_LPM
#include <rte_lpm.h>
#endif /* RTE_LIBRTE_LPM */
#include <rte_string_fns.h>
#include "process.h"
@ -196,6 +203,7 @@ run_object_creation_tests(void)
}
printf("# Checked rte_mempool_create() OK\n");
#ifdef RTE_LIBRTE_HASH
const struct rte_hash_parameters hash_params = { .name = "test_mp_hash" };
rte_errno=0;
if ((rte_hash_create(&hash_params) != NULL) &&
@ -213,7 +221,9 @@ run_object_creation_tests(void)
return -1;
}
printf("# Checked rte_fbk_hash_create() OK\n");
#endif
#ifdef RTE_LIBRTE_LPM
rte_errno=0;
if ((rte_lpm_create("test_lpm", size, rte_socket_id(), 0) != NULL) &&
(rte_lpm_find_existing("test_lpm") == NULL)){
@ -221,6 +231,7 @@ run_object_creation_tests(void)
return -1;
}
printf("# Checked rte_lpm_create() OK\n");
#endif
/* Run a test_pci call */
if (test_pci() != 0) {