From 1c14c98d7b76ce2eac7c780903c6023e249b6c67 Mon Sep 17 00:00:00 2001 From: Intel Date: Mon, 3 Jun 2013 00:00:00 +0000 Subject: [PATCH] app: fix build when some libs are disabled Signed-off-by: Intel --- app/test/test_func_reentrancy.c | 15 +++++++++++++++ app/test/test_lpm.c | 8 ++++---- app/test/test_mp_secondary.c | 11 +++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c index 6ece836451..dba47b5fc8 100644 --- a/app/test/test_func_reentrancy.c +++ b/app/test/test_func_reentrancy.c @@ -58,10 +58,17 @@ #include #include #include + +#ifdef RTE_LIBRTE_HASH #include #include #include +#endif /* RTE_LIBRTE_HASH */ + +#ifdef RTE_LIBRTE_LPM #include +#endif /* RTE_LIBRTE_LPM */ + #include #include @@ -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 */ }; /** diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c index a747ec64bc..162c22a7d6 100644 --- a/app/test/test_lpm.c +++ b/app/test/test_lpm.c @@ -47,13 +47,13 @@ #include #include +#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 */ diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c index 80099b3216..ed955905fc 100644 --- a/app/test/test_mp_secondary.c +++ b/app/test/test_mp_secondary.c @@ -70,9 +70,16 @@ #include #include #include + +#ifdef RTE_LIBRTE_HASH #include #include +#endif /* RTE_LIBRTE_HASH */ + +#ifdef RTE_LIBRTE_LPM #include +#endif /* RTE_LIBRTE_LPM */ + #include #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) {