Message ID | 20170118220137.6817-5-mike.holmes@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | remove Linux specifics and dependence on test dir | expand |
On 01/19/17 01:01, Mike Holmes wrote: > There is no reason that the helpers need to depend on the test directory > so remove the offending links > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > helper/test/Makefile.am | 26 ++++++++--- > helper/test/chksum.c | 18 ++++---- > helper/test/cuckootable.c | 4 +- > helper/test/iplookuptable.c | 4 +- > helper/test/linux-generic/process.c | 14 +++--- > helper/test/linux-generic/thread.c | 14 +++--- > helper/test/odpthreads.c | 18 ++++---- > helper/test/parse.c | 86 ++++++++++++++++++------------------- > helper/test/table.c | 12 +++--- > 9 files changed, 106 insertions(+), 90 deletions(-) > > diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am > index 7d55ae6..8d5bc9d 100644 > --- a/helper/test/Makefile.am > +++ b/helper/test/Makefile.am > @@ -1,10 +1,27 @@ > -include $(top_srcdir)/test/Makefile.inc > +include $(top_srcdir)/platform/@with_platform@/Makefile.inc > > -AM_CFLAGS += -I$(srcdir)/common > +LIB = $(top_builddir)/lib > + > +#in the following line, the libs using the symbols should come before > +#the libs containing them! The includer is given a chance to add things > +#before libodp by setting PRE_LDADD before the inclusion. > +LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la > + LIBDIR is better name here, but might be it too long and you will have to write that in 2 lines. In that case might be reasonable to use directly $(top_builddir) > +INCFLAGS = \ > + -I$(top_builddir)/platform/@with_platform@/include \ > + -I$(top_srcdir)/helper/include \ > + -I$(top_srcdir)/helper/platform/@with_helper_platform@/include \ > + -I$(top_srcdir)/include \ > + -I$(top_srcdir)/platform/@with_platform@/include \ > + -I$(top_builddir)/include \ > + -I$(top_srcdir)/helper > + > +ODP_PLATFORM=${with_platform} > + > +AM_CFLAGS += $(INCFLAGS) > +AM_CXXFLAGS = $(INCFLAGS) += here in case if some flags will be passed from ./configure ? > AM_LDFLAGS += -static > > -TESTS_ENVIRONMENT += TEST_DIR=${builddir} > - > EXECUTABLES = chksum$(EXEEXT) \ > cuckootable$(EXEEXT) \ > parse$(EXEEXT)\ > @@ -38,7 +55,6 @@ EXTRA_DIST = odpthreads_as_processes odpthreads_as_pthreads > dist_chksum_SOURCES = chksum.c > dist_cuckootable_SOURCES = cuckootable.c > dist_odpthreads_SOURCES = odpthreads.c > -odpthreads_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la > dist_parse_SOURCES = parse.c > dist_table_SOURCES = table.c > dist_iplookuptable_SOURCES = iplookuptable.c > diff --git a/helper/test/chksum.c b/helper/test/chksum.c > index 749d495..7c572ae 100644 > --- a/helper/test/chksum.c > +++ b/helper/test/chksum.c > @@ -4,7 +4,7 @@ > * SPDX-License-Identifier: BSD-3-Clause > */ > > -#include <test_debug.h> > +#include "odph_debug.h" > #include <odp_api.h> > #include <odp/helper/eth.h> > #include <odp/helper/ip.h> > @@ -21,7 +21,7 @@ struct udata_struct { > }; > > /* Create additional dataplane threads */ > -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > { > odp_instance_t instance; > int status = 0; > @@ -41,17 +41,17 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > odp_pool_capability_t capa; > > if (odp_init_global(&instance, NULL, NULL)) { > - LOG_ERR("Error: ODP global init failed.\n"); > + ODPH_ERR("Error: ODP global init failed.\n"); > exit(EXIT_FAILURE); > } > > if (odp_init_local(instance, ODP_THREAD_WORKER)) { > - LOG_ERR("Error: ODP local init failed.\n"); > + ODPH_ERR("Error: ODP local init failed.\n"); > exit(EXIT_FAILURE); > } > > if (odp_pool_capability(&capa) < 0) { > - LOG_ERR("Error: ODP global init failed.\n"); > + ODPH_ERR("Error: ODP global init failed.\n"); > exit(EXIT_FAILURE); > } > > @@ -91,12 +91,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); > > if (odph_ipv4_addr_parse(&dstip, "192.168.0.1")) { > - LOG_ERR("Error: parse ip\n"); > + ODPH_ERR("Error: parse ip\n"); > return -1; > } > > if (odph_ipv4_addr_parse(&srcip, "192.168.0.2")) { > - LOG_ERR("Error: parse ip\n"); > + ODPH_ERR("Error: parse ip\n"); > return -1; > } > > @@ -139,12 +139,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > return -1; > > if (odp_term_local()) { > - LOG_ERR("Error: ODP local term failed.\n"); > + ODPH_ERR("Error: ODP local term failed.\n"); > exit(EXIT_FAILURE); > } > > if (odp_term_global(instance)) { > - LOG_ERR("Error: ODP global term failed.\n"); > + ODPH_ERR("Error: ODP global term failed.\n"); > exit(EXIT_FAILURE); > } > > diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c > index 5b4333b..6736f2b 100644 > --- a/helper/test/cuckootable.c > +++ b/helper/test/cuckootable.c > @@ -48,7 +48,7 @@ > #include <time.h> > > #include <odp_api.h> > -#include <test_debug.h> > +#include <odph_debug.h> > #include <../odph_cuckootable.h> > > /******************************************************************************* > @@ -534,7 +534,7 @@ test_cuckoo_hash_table(void) > return 0; > } > > -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > { > odp_instance_t instance; > int ret = 0; > diff --git a/helper/test/iplookuptable.c b/helper/test/iplookuptable.c > index e1d2820..86aa1b3 100644 > --- a/helper/test/iplookuptable.c > +++ b/helper/test/iplookuptable.c > @@ -11,7 +11,7 @@ > #include <errno.h> > > #include <odp_api.h> > -#include <test_debug.h> > +#include <odph_debug.h> > #include <../odph_iplookuptable.h> > #include <odp/helper/ip.h> > > @@ -138,7 +138,7 @@ static int test_ip_lookup_table(void) > return 0; > } > > -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > { > odp_instance_t instance; > int ret = 0; > diff --git a/helper/test/linux-generic/process.c b/helper/test/linux-generic/process.c > index f641128..f9bdc3e 100644 > --- a/helper/test/linux-generic/process.c > +++ b/helper/test/linux-generic/process.c > @@ -4,13 +4,13 @@ > * SPDX-License-Identifier: BSD-3-Clause > */ > > -#include <test_debug.h> > +#include <odph_debug.h> > #include <odp_api.h> > #include <odp/helper/platform/linux-generic/threads_extn.h> > > #define NUMBER_WORKERS 16 /* 0 = max */ > > -static void *worker_fn(void *arg TEST_UNUSED) > +static void *worker_fn(void *arg ODPH_UNUSED) > { > /* depend on the odp helper to call odp_init_local */ > printf("Worker thread on CPU %d\n", odp_cpu_id()); > @@ -19,7 +19,7 @@ static void *worker_fn(void *arg TEST_UNUSED) > } > > /* Create additional dataplane processes */ > -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > { > odp_cpumask_t cpu_mask; > int num_workers; > @@ -31,12 +31,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > odph_linux_thr_params_t thr_params; > > if (odp_init_global(&instance, NULL, NULL)) { > - LOG_ERR("Error: ODP global init failed.\n"); > + ODPH_ERR("Error: ODP global init failed.\n"); > exit(EXIT_FAILURE); > } > > if (odp_init_local(instance, ODP_THREAD_CONTROL)) { > - LOG_ERR("Error: ODP local init failed.\n"); > + ODPH_ERR("Error: ODP local init failed.\n"); > exit(EXIT_FAILURE); > } > > @@ -71,7 +71,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > ret = odph_linux_process_fork_n(proc, &cpu_mask, &thr_params); > > if (ret < 0) { > - LOG_ERR("Fork workers failed %i\n", ret); > + ODPH_ERR("Fork workers failed %i\n", ret); > return -1; > } > > @@ -83,7 +83,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > odph_linux_process_wait_n(proc, num_workers); > > if (odp_term_global(instance)) { > - LOG_ERR("Error: ODP global term failed.\n"); > + ODPH_ERR("Error: ODP global term failed.\n"); > exit(EXIT_FAILURE); > } > } > diff --git a/helper/test/linux-generic/thread.c b/helper/test/linux-generic/thread.c > index f1ca1b7..919f00e 100644 > --- a/helper/test/linux-generic/thread.c > +++ b/helper/test/linux-generic/thread.c > @@ -4,12 +4,12 @@ > * SPDX-License-Identifier: BSD-3-Clause > */ > > -#include <test_debug.h> > +#include <odph_debug.h> > #include <odp_api.h> > #include <odp/helper/platform/linux-generic/threads_extn.h> > > #define NUMBER_WORKERS 16 > -static void *worker_fn(void *arg TEST_UNUSED) > +static void *worker_fn(void *arg ODPH_UNUSED) > { > /* depend on the odp helper to call odp_init_local */ > > @@ -21,7 +21,7 @@ static void *worker_fn(void *arg TEST_UNUSED) > } > > /* Create additional dataplane threads */ > -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > { > odph_linux_pthread_t thread_tbl[NUMBER_WORKERS]; > odp_cpumask_t cpu_mask; > @@ -32,12 +32,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > odph_linux_thr_params_t thr_params; > > if (odp_init_global(&instance, NULL, NULL)) { > - LOG_ERR("Error: ODP global init failed.\n"); > + ODPH_ERR("Error: ODP global init failed.\n"); > exit(EXIT_FAILURE); > } > > if (odp_init_local(instance, ODP_THREAD_CONTROL)) { > - LOG_ERR("Error: ODP local init failed.\n"); > + ODPH_ERR("Error: ODP local init failed.\n"); > exit(EXIT_FAILURE); > } > > @@ -74,12 +74,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > odph_linux_pthread_join(thread_tbl, num_workers); > > if (odp_term_local()) { > - LOG_ERR("Error: ODP local term failed.\n"); > + ODPH_ERR("Error: ODP local term failed.\n"); > exit(EXIT_FAILURE); > } > > if (odp_term_global(instance)) { > - LOG_ERR("Error: ODP global term failed.\n"); > + ODPH_ERR("Error: ODP global term failed.\n"); > exit(EXIT_FAILURE); > } > > diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c > index 216bccd..4bb3c3b 100644 > --- a/helper/test/odpthreads.c > +++ b/helper/test/odpthreads.c > @@ -13,7 +13,7 @@ > #include <unistd.h> > #include <stdlib.h> > > -#include <test_debug.h> > +#include <odph_debug.h> > #include <odp_api.h> > #include <odp/helper/threads.h> > > @@ -25,7 +25,7 @@ static void main_exit(void); > /* ODP application instance */ > static odp_instance_t odp_instance; > > -static int worker_fn(void *arg TEST_UNUSED) > +static int worker_fn(void *arg ODPH_UNUSED) > { > int cpu; > odp_cpumask_t workers; > @@ -74,12 +74,12 @@ int main(int argc, char *argv[]) > odph_parse_options(argc, argv, NULL, NULL); > > if (odp_init_global(&odp_instance, NULL, NULL)) { > - LOG_ERR("Error: ODP global init failed.\n"); > + ODPH_ERR("Error: ODP global init failed.\n"); > exit(EXIT_FAILURE); > } > > if (odp_init_local(odp_instance, ODP_THREAD_CONTROL)) { > - LOG_ERR("Error: ODP local init failed.\n"); > + ODPH_ERR("Error: ODP local init failed.\n"); > exit(EXIT_FAILURE); > } > > @@ -89,13 +89,13 @@ int main(int argc, char *argv[]) > odp_cpumask_zero(&cpu_mask); > /* allocate the 1st available control cpu to main process */ > if (odp_cpumask_default_control(&cpu_mask, 1) != 1) { > - LOG_ERR("Allocate main process CPU core failed.\n"); > + ODPH_ERR("Allocate main process CPU core failed.\n"); > exit(EXIT_FAILURE); > } > > cpu = odp_cpumask_first(&cpu_mask); > if (odph_odpthread_setaffinity(cpu) != 0) { > - LOG_ERR("Set main process affinify to " > + ODPH_ERR("Set main process affinify to " > "cpu(%d) failed.\n", cpu); > exit(EXIT_FAILURE); > } > @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) > /* read back affinity to verify */ > affinity = odph_odpthread_getaffinity(); > if ((affinity < 0) || (cpu != affinity)) { > - LOG_ERR("Verify main process affinity failed: " > + ODPH_ERR("Verify main process affinity failed: " > "set(%d) read(%d).\n", cpu, affinity); > exit(EXIT_FAILURE); > } > @@ -152,12 +152,12 @@ int main(int argc, char *argv[]) > static void main_exit(void) > { > if (odp_term_local()) { > - LOG_ERR("Error: ODP local term failed.\n"); > + ODPH_ERR("Error: ODP local term failed.\n"); > _exit(EXIT_FAILURE); > } > > if (odp_term_global(odp_instance)) { > - LOG_ERR("Error: ODP global term failed.\n"); > + ODPH_ERR("Error: ODP global term failed.\n"); > _exit(EXIT_FAILURE); > } > } > diff --git a/helper/test/parse.c b/helper/test/parse.c > index b5a4ab4..26dfc68 100644 > --- a/helper/test/parse.c > +++ b/helper/test/parse.c > @@ -4,7 +4,7 @@ > * SPDX-License-Identifier: BSD-3-Clause > */ > > -#include <test_debug.h> > +#include <odph_debug.h> > > #include <odp_api.h> > #include <odp/helper/eth.h> > @@ -42,37 +42,37 @@ static int test_mac(void) > > /* String must not start with other chars */ > if (!odph_eth_addr_parse(&mac, "foo 01:02:03:04:05:06")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Missing digit */ > if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Missing colon */ > if (!odph_eth_addr_parse(&mac, "01:02:03:04:05 06")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Too large value */ > if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:1ff")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Negative value */ > if (!odph_eth_addr_parse(&mac, "-1:02:03:04:05:06")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Failed function call must not store address */ > if (different_mac(&mac, &ref)) { > - LOG_ERR("Modified address when failed\n"); > + ODPH_ERR("Modified address when failed\n"); > return -1; > } > > @@ -86,36 +86,36 @@ static int test_mac(void) > /* Zero pre-fixed */ > memset(&mac, 0, sizeof(odph_ethaddr_t)); > if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_mac(&mac, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > /* Not zero pre-fixed */ > memset(&mac, 0, sizeof(odph_ethaddr_t)); > if (odph_eth_addr_parse(&mac, "1:2:3:4:5:6")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_mac(&mac, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > /* String may continue with other chars */ > memset(&mac, 0, sizeof(odph_ethaddr_t)); > if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06 foobar")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_mac(&mac, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > @@ -129,24 +129,24 @@ static int test_mac(void) > /* Zero pre-fixed */ > memset(&mac, 0, sizeof(odph_ethaddr_t)); > if (odph_eth_addr_parse(&mac, "0a:0b:0c:0d:0e:0f")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_mac(&mac, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > /* Not zero pre-fixed */ > memset(&mac, 0, sizeof(odph_ethaddr_t)); > if (odph_eth_addr_parse(&mac, "a:b:c:d:e:f")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_mac(&mac, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > @@ -160,12 +160,12 @@ static int test_mac(void) > /* Dual digits */ > memset(&mac, 0, sizeof(odph_ethaddr_t)); > if (odph_eth_addr_parse(&mac, "1a:2b:3c:4d:5e:6f")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_mac(&mac, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > @@ -174,12 +174,12 @@ static int test_mac(void) > /* All zeros */ > memset(&mac, 0, sizeof(odph_ethaddr_t)); > if (odph_eth_addr_parse(&mac, "00:00:00:00:00:00")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_mac(&mac, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > @@ -188,12 +188,12 @@ static int test_mac(void) > /* All ones */ > memset(&mac, 0, sizeof(odph_ethaddr_t)); > if (odph_eth_addr_parse(&mac, "ff:ff:ff:ff:ff:ff")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_mac(&mac, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > @@ -215,37 +215,37 @@ static int test_ipv4(void) > > /* String must not start with other chars */ > if (!odph_ipv4_addr_parse(&ip_addr, "foo 1.2.3.4")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Missing digit */ > if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Missing dot */ > if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3 4")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Too large value */ > if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.256")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Negative value */ > if (!odph_ipv4_addr_parse(&ip_addr, "-1.2.3.4")) { > - LOG_ERR("Accepted bad string\n"); > + ODPH_ERR("Accepted bad string\n"); > return -1; > } > > /* Failed function call must not store address */ > if (different_ipv4(&ip_addr, &ref)) { > - LOG_ERR("Modified address when failed\n"); > + ODPH_ERR("Modified address when failed\n"); > return -1; > } > > @@ -254,36 +254,36 @@ static int test_ipv4(void) > /* Zero pre-fixed */ > ip_addr = 0; > if (odph_ipv4_addr_parse(&ip_addr, "001.002.003.004")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_ipv4(&ip_addr, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > /* Not zero pre-fixed */ > ip_addr = 0; > if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_ipv4(&ip_addr, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > /* String may continue with other chars */ > ip_addr = 0; > if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4 foobar")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_ipv4(&ip_addr, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > @@ -292,12 +292,12 @@ static int test_ipv4(void) > /* Dual digits */ > ip_addr = 0; > if (odph_ipv4_addr_parse(&ip_addr, "26.43.60.77")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_ipv4(&ip_addr, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > @@ -306,12 +306,12 @@ static int test_ipv4(void) > /* Triple digits */ > ip_addr = 0; > if (odph_ipv4_addr_parse(&ip_addr, "161.178.195.212")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_ipv4(&ip_addr, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > @@ -320,12 +320,12 @@ static int test_ipv4(void) > /* All zeros */ > ip_addr = 0; > if (odph_ipv4_addr_parse(&ip_addr, "0.0.0.0")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_ipv4(&ip_addr, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > @@ -334,12 +334,12 @@ static int test_ipv4(void) > /* All ones */ > ip_addr = 0; > if (odph_ipv4_addr_parse(&ip_addr, "255.255.255.255")) { > - LOG_ERR("Parse call failed\n"); > + ODPH_ERR("Parse call failed\n"); > return -1; > } > > if (different_ipv4(&ip_addr, &ref)) { > - LOG_ERR("Bad parse result\n"); > + ODPH_ERR("Bad parse result\n"); > return -1; > } > > diff --git a/helper/test/table.c b/helper/test/table.c > index abb5b3b..3b74b22 100644 > --- a/helper/test/table.c > +++ b/helper/test/table.c > @@ -4,7 +4,7 @@ > * SPDX-License-Identifier:BSD-3-Clause > */ > > -#include <test_debug.h> > +#include <odph_debug.h> > #include <../odph_hashtable.h> > #include <../odph_lineartable.h> > #include <odp_api.h> > @@ -25,7 +25,7 @@ > * value (data): MAC address of the next hop station (6 bytes). > */ > > -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > { > odp_instance_t instance; > int ret = 0; > @@ -43,12 +43,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > > ret = odp_init_global(&instance, NULL, NULL); > if (ret != 0) { > - LOG_ERR("odp_shm_init_global fail\n"); > + ODPH_ERR("odp_shm_init_global fail\n"); > exit(EXIT_FAILURE); > } > ret = odp_init_local(instance, ODP_THREAD_WORKER); > if (ret != 0) { > - LOG_ERR("odp_shm_init_local fail\n"); > + ODPH_ERR("odp_shm_init_local fail\n"); > exit(EXIT_FAILURE); > } > > @@ -121,12 +121,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > printf("all test finished success!!\n"); > > if (odp_term_local()) { > - LOG_ERR("Error: ODP local term failed.\n"); > + ODPH_ERR("Error: ODP local term failed.\n"); > exit(EXIT_FAILURE); > } > > if (odp_term_global(instance)) { > - LOG_ERR("Error: ODP global term failed.\n"); > + ODPH_ERR("Error: ODP global term failed.\n"); > exit(EXIT_FAILURE); > } > >
On 19 January 2017 at 09:45, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > On 01/19/17 01:01, Mike Holmes wrote: >> There is no reason that the helpers need to depend on the test directory >> so remove the offending links >> >> Signed-off-by: Mike Holmes <mike.holmes@linaro.org> >> --- >> helper/test/Makefile.am | 26 ++++++++--- >> helper/test/chksum.c | 18 ++++---- >> helper/test/cuckootable.c | 4 +- >> helper/test/iplookuptable.c | 4 +- >> helper/test/linux-generic/process.c | 14 +++--- >> helper/test/linux-generic/thread.c | 14 +++--- >> helper/test/odpthreads.c | 18 ++++---- >> helper/test/parse.c | 86 ++++++++++++++++++------------------- >> helper/test/table.c | 12 +++--- >> 9 files changed, 106 insertions(+), 90 deletions(-) >> >> diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am >> index 7d55ae6..8d5bc9d 100644 >> --- a/helper/test/Makefile.am >> +++ b/helper/test/Makefile.am >> @@ -1,10 +1,27 @@ >> -include $(top_srcdir)/test/Makefile.inc >> +include $(top_srcdir)/platform/@with_platform@/Makefile.inc >> >> -AM_CFLAGS += -I$(srcdir)/common >> +LIB = $(top_builddir)/lib >> + >> +#in the following line, the libs using the symbols should come before >> +#the libs containing them! The includer is given a chance to add things >> +#before libodp by setting PRE_LDADD before the inclusion. >> +LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la >> + > > LIBDIR is better name here, but might be it too long and you will have > to write that in 2 lines. In that case might be reasonable to use > directly $(top_builddir) It might be a better name but it would need a global change or it woudl not follow the pattern form other files mike@mike-desktop:~/work/git/odp$ git grep LDADD | wc -l 35 There are 35 uses of this VARIABLE so I think that is better done globally > > >> +INCFLAGS = \ >> + -I$(top_builddir)/platform/@with_platform@/include \ >> + -I$(top_srcdir)/helper/include \ >> + -I$(top_srcdir)/helper/platform/@with_helper_platform@/include \ >> + -I$(top_srcdir)/include \ >> + -I$(top_srcdir)/platform/@with_platform@/include \ >> + -I$(top_builddir)/include \ >> + -I$(top_srcdir)/helper >> + >> +ODP_PLATFORM=${with_platform} >> + >> +AM_CFLAGS += $(INCFLAGS) >> +AM_CXXFLAGS = $(INCFLAGS) > > += here in case if some flags will be passed from ./configure ? Will fix > >> AM_LDFLAGS += -static >> >> -TESTS_ENVIRONMENT += TEST_DIR=${builddir} >> - >> EXECUTABLES = chksum$(EXEEXT) \ >> cuckootable$(EXEEXT) \ >> parse$(EXEEXT)\ >> @@ -38,7 +55,6 @@ EXTRA_DIST = odpthreads_as_processes odpthreads_as_pthreads >> dist_chksum_SOURCES = chksum.c >> dist_cuckootable_SOURCES = cuckootable.c >> dist_odpthreads_SOURCES = odpthreads.c >> -odpthreads_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la >> dist_parse_SOURCES = parse.c >> dist_table_SOURCES = table.c >> dist_iplookuptable_SOURCES = iplookuptable.c >> diff --git a/helper/test/chksum.c b/helper/test/chksum.c >> index 749d495..7c572ae 100644 >> --- a/helper/test/chksum.c >> +++ b/helper/test/chksum.c >> @@ -4,7 +4,7 @@ >> * SPDX-License-Identifier: BSD-3-Clause >> */ >> >> -#include <test_debug.h> >> +#include "odph_debug.h" >> #include <odp_api.h> >> #include <odp/helper/eth.h> >> #include <odp/helper/ip.h> >> @@ -21,7 +21,7 @@ struct udata_struct { >> }; >> >> /* Create additional dataplane threads */ >> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >> { >> odp_instance_t instance; >> int status = 0; >> @@ -41,17 +41,17 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> odp_pool_capability_t capa; >> >> if (odp_init_global(&instance, NULL, NULL)) { >> - LOG_ERR("Error: ODP global init failed.\n"); >> + ODPH_ERR("Error: ODP global init failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> if (odp_init_local(instance, ODP_THREAD_WORKER)) { >> - LOG_ERR("Error: ODP local init failed.\n"); >> + ODPH_ERR("Error: ODP local init failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> if (odp_pool_capability(&capa) < 0) { >> - LOG_ERR("Error: ODP global init failed.\n"); >> + ODPH_ERR("Error: ODP global init failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> @@ -91,12 +91,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); >> >> if (odph_ipv4_addr_parse(&dstip, "192.168.0.1")) { >> - LOG_ERR("Error: parse ip\n"); >> + ODPH_ERR("Error: parse ip\n"); >> return -1; >> } >> >> if (odph_ipv4_addr_parse(&srcip, "192.168.0.2")) { >> - LOG_ERR("Error: parse ip\n"); >> + ODPH_ERR("Error: parse ip\n"); >> return -1; >> } >> >> @@ -139,12 +139,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> return -1; >> >> if (odp_term_local()) { >> - LOG_ERR("Error: ODP local term failed.\n"); >> + ODPH_ERR("Error: ODP local term failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> if (odp_term_global(instance)) { >> - LOG_ERR("Error: ODP global term failed.\n"); >> + ODPH_ERR("Error: ODP global term failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c >> index 5b4333b..6736f2b 100644 >> --- a/helper/test/cuckootable.c >> +++ b/helper/test/cuckootable.c >> @@ -48,7 +48,7 @@ >> #include <time.h> >> >> #include <odp_api.h> >> -#include <test_debug.h> >> +#include <odph_debug.h> >> #include <../odph_cuckootable.h> >> >> /******************************************************************************* >> @@ -534,7 +534,7 @@ test_cuckoo_hash_table(void) >> return 0; >> } >> >> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >> { >> odp_instance_t instance; >> int ret = 0; >> diff --git a/helper/test/iplookuptable.c b/helper/test/iplookuptable.c >> index e1d2820..86aa1b3 100644 >> --- a/helper/test/iplookuptable.c >> +++ b/helper/test/iplookuptable.c >> @@ -11,7 +11,7 @@ >> #include <errno.h> >> >> #include <odp_api.h> >> -#include <test_debug.h> >> +#include <odph_debug.h> >> #include <../odph_iplookuptable.h> >> #include <odp/helper/ip.h> >> >> @@ -138,7 +138,7 @@ static int test_ip_lookup_table(void) >> return 0; >> } >> >> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >> { >> odp_instance_t instance; >> int ret = 0; >> diff --git a/helper/test/linux-generic/process.c b/helper/test/linux-generic/process.c >> index f641128..f9bdc3e 100644 >> --- a/helper/test/linux-generic/process.c >> +++ b/helper/test/linux-generic/process.c >> @@ -4,13 +4,13 @@ >> * SPDX-License-Identifier: BSD-3-Clause >> */ >> >> -#include <test_debug.h> >> +#include <odph_debug.h> >> #include <odp_api.h> >> #include <odp/helper/platform/linux-generic/threads_extn.h> >> >> #define NUMBER_WORKERS 16 /* 0 = max */ >> >> -static void *worker_fn(void *arg TEST_UNUSED) >> +static void *worker_fn(void *arg ODPH_UNUSED) >> { >> /* depend on the odp helper to call odp_init_local */ >> printf("Worker thread on CPU %d\n", odp_cpu_id()); >> @@ -19,7 +19,7 @@ static void *worker_fn(void *arg TEST_UNUSED) >> } >> >> /* Create additional dataplane processes */ >> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >> { >> odp_cpumask_t cpu_mask; >> int num_workers; >> @@ -31,12 +31,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> odph_linux_thr_params_t thr_params; >> >> if (odp_init_global(&instance, NULL, NULL)) { >> - LOG_ERR("Error: ODP global init failed.\n"); >> + ODPH_ERR("Error: ODP global init failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> if (odp_init_local(instance, ODP_THREAD_CONTROL)) { >> - LOG_ERR("Error: ODP local init failed.\n"); >> + ODPH_ERR("Error: ODP local init failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> @@ -71,7 +71,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> ret = odph_linux_process_fork_n(proc, &cpu_mask, &thr_params); >> >> if (ret < 0) { >> - LOG_ERR("Fork workers failed %i\n", ret); >> + ODPH_ERR("Fork workers failed %i\n", ret); >> return -1; >> } >> >> @@ -83,7 +83,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> odph_linux_process_wait_n(proc, num_workers); >> >> if (odp_term_global(instance)) { >> - LOG_ERR("Error: ODP global term failed.\n"); >> + ODPH_ERR("Error: ODP global term failed.\n"); >> exit(EXIT_FAILURE); >> } >> } >> diff --git a/helper/test/linux-generic/thread.c b/helper/test/linux-generic/thread.c >> index f1ca1b7..919f00e 100644 >> --- a/helper/test/linux-generic/thread.c >> +++ b/helper/test/linux-generic/thread.c >> @@ -4,12 +4,12 @@ >> * SPDX-License-Identifier: BSD-3-Clause >> */ >> >> -#include <test_debug.h> >> +#include <odph_debug.h> >> #include <odp_api.h> >> #include <odp/helper/platform/linux-generic/threads_extn.h> >> >> #define NUMBER_WORKERS 16 >> -static void *worker_fn(void *arg TEST_UNUSED) >> +static void *worker_fn(void *arg ODPH_UNUSED) >> { >> /* depend on the odp helper to call odp_init_local */ >> >> @@ -21,7 +21,7 @@ static void *worker_fn(void *arg TEST_UNUSED) >> } >> >> /* Create additional dataplane threads */ >> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >> { >> odph_linux_pthread_t thread_tbl[NUMBER_WORKERS]; >> odp_cpumask_t cpu_mask; >> @@ -32,12 +32,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> odph_linux_thr_params_t thr_params; >> >> if (odp_init_global(&instance, NULL, NULL)) { >> - LOG_ERR("Error: ODP global init failed.\n"); >> + ODPH_ERR("Error: ODP global init failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> if (odp_init_local(instance, ODP_THREAD_CONTROL)) { >> - LOG_ERR("Error: ODP local init failed.\n"); >> + ODPH_ERR("Error: ODP local init failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> @@ -74,12 +74,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> odph_linux_pthread_join(thread_tbl, num_workers); >> >> if (odp_term_local()) { >> - LOG_ERR("Error: ODP local term failed.\n"); >> + ODPH_ERR("Error: ODP local term failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> if (odp_term_global(instance)) { >> - LOG_ERR("Error: ODP global term failed.\n"); >> + ODPH_ERR("Error: ODP global term failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c >> index 216bccd..4bb3c3b 100644 >> --- a/helper/test/odpthreads.c >> +++ b/helper/test/odpthreads.c >> @@ -13,7 +13,7 @@ >> #include <unistd.h> >> #include <stdlib.h> >> >> -#include <test_debug.h> >> +#include <odph_debug.h> >> #include <odp_api.h> >> #include <odp/helper/threads.h> >> >> @@ -25,7 +25,7 @@ static void main_exit(void); >> /* ODP application instance */ >> static odp_instance_t odp_instance; >> >> -static int worker_fn(void *arg TEST_UNUSED) >> +static int worker_fn(void *arg ODPH_UNUSED) >> { >> int cpu; >> odp_cpumask_t workers; >> @@ -74,12 +74,12 @@ int main(int argc, char *argv[]) >> odph_parse_options(argc, argv, NULL, NULL); >> >> if (odp_init_global(&odp_instance, NULL, NULL)) { >> - LOG_ERR("Error: ODP global init failed.\n"); >> + ODPH_ERR("Error: ODP global init failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> if (odp_init_local(odp_instance, ODP_THREAD_CONTROL)) { >> - LOG_ERR("Error: ODP local init failed.\n"); >> + ODPH_ERR("Error: ODP local init failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> @@ -89,13 +89,13 @@ int main(int argc, char *argv[]) >> odp_cpumask_zero(&cpu_mask); >> /* allocate the 1st available control cpu to main process */ >> if (odp_cpumask_default_control(&cpu_mask, 1) != 1) { >> - LOG_ERR("Allocate main process CPU core failed.\n"); >> + ODPH_ERR("Allocate main process CPU core failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> cpu = odp_cpumask_first(&cpu_mask); >> if (odph_odpthread_setaffinity(cpu) != 0) { >> - LOG_ERR("Set main process affinify to " >> + ODPH_ERR("Set main process affinify to " >> "cpu(%d) failed.\n", cpu); >> exit(EXIT_FAILURE); >> } >> @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) >> /* read back affinity to verify */ >> affinity = odph_odpthread_getaffinity(); >> if ((affinity < 0) || (cpu != affinity)) { >> - LOG_ERR("Verify main process affinity failed: " >> + ODPH_ERR("Verify main process affinity failed: " >> "set(%d) read(%d).\n", cpu, affinity); >> exit(EXIT_FAILURE); >> } >> @@ -152,12 +152,12 @@ int main(int argc, char *argv[]) >> static void main_exit(void) >> { >> if (odp_term_local()) { >> - LOG_ERR("Error: ODP local term failed.\n"); >> + ODPH_ERR("Error: ODP local term failed.\n"); >> _exit(EXIT_FAILURE); >> } >> >> if (odp_term_global(odp_instance)) { >> - LOG_ERR("Error: ODP global term failed.\n"); >> + ODPH_ERR("Error: ODP global term failed.\n"); >> _exit(EXIT_FAILURE); >> } >> } >> diff --git a/helper/test/parse.c b/helper/test/parse.c >> index b5a4ab4..26dfc68 100644 >> --- a/helper/test/parse.c >> +++ b/helper/test/parse.c >> @@ -4,7 +4,7 @@ >> * SPDX-License-Identifier: BSD-3-Clause >> */ >> >> -#include <test_debug.h> >> +#include <odph_debug.h> >> >> #include <odp_api.h> >> #include <odp/helper/eth.h> >> @@ -42,37 +42,37 @@ static int test_mac(void) >> >> /* String must not start with other chars */ >> if (!odph_eth_addr_parse(&mac, "foo 01:02:03:04:05:06")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Missing digit */ >> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Missing colon */ >> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05 06")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Too large value */ >> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:1ff")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Negative value */ >> if (!odph_eth_addr_parse(&mac, "-1:02:03:04:05:06")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Failed function call must not store address */ >> if (different_mac(&mac, &ref)) { >> - LOG_ERR("Modified address when failed\n"); >> + ODPH_ERR("Modified address when failed\n"); >> return -1; >> } >> >> @@ -86,36 +86,36 @@ static int test_mac(void) >> /* Zero pre-fixed */ >> memset(&mac, 0, sizeof(odph_ethaddr_t)); >> if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_mac(&mac, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> /* Not zero pre-fixed */ >> memset(&mac, 0, sizeof(odph_ethaddr_t)); >> if (odph_eth_addr_parse(&mac, "1:2:3:4:5:6")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_mac(&mac, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> /* String may continue with other chars */ >> memset(&mac, 0, sizeof(odph_ethaddr_t)); >> if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06 foobar")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_mac(&mac, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> @@ -129,24 +129,24 @@ static int test_mac(void) >> /* Zero pre-fixed */ >> memset(&mac, 0, sizeof(odph_ethaddr_t)); >> if (odph_eth_addr_parse(&mac, "0a:0b:0c:0d:0e:0f")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_mac(&mac, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> /* Not zero pre-fixed */ >> memset(&mac, 0, sizeof(odph_ethaddr_t)); >> if (odph_eth_addr_parse(&mac, "a:b:c:d:e:f")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_mac(&mac, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> @@ -160,12 +160,12 @@ static int test_mac(void) >> /* Dual digits */ >> memset(&mac, 0, sizeof(odph_ethaddr_t)); >> if (odph_eth_addr_parse(&mac, "1a:2b:3c:4d:5e:6f")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_mac(&mac, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> @@ -174,12 +174,12 @@ static int test_mac(void) >> /* All zeros */ >> memset(&mac, 0, sizeof(odph_ethaddr_t)); >> if (odph_eth_addr_parse(&mac, "00:00:00:00:00:00")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_mac(&mac, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> @@ -188,12 +188,12 @@ static int test_mac(void) >> /* All ones */ >> memset(&mac, 0, sizeof(odph_ethaddr_t)); >> if (odph_eth_addr_parse(&mac, "ff:ff:ff:ff:ff:ff")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_mac(&mac, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> @@ -215,37 +215,37 @@ static int test_ipv4(void) >> >> /* String must not start with other chars */ >> if (!odph_ipv4_addr_parse(&ip_addr, "foo 1.2.3.4")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Missing digit */ >> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Missing dot */ >> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3 4")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Too large value */ >> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.256")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Negative value */ >> if (!odph_ipv4_addr_parse(&ip_addr, "-1.2.3.4")) { >> - LOG_ERR("Accepted bad string\n"); >> + ODPH_ERR("Accepted bad string\n"); >> return -1; >> } >> >> /* Failed function call must not store address */ >> if (different_ipv4(&ip_addr, &ref)) { >> - LOG_ERR("Modified address when failed\n"); >> + ODPH_ERR("Modified address when failed\n"); >> return -1; >> } >> >> @@ -254,36 +254,36 @@ static int test_ipv4(void) >> /* Zero pre-fixed */ >> ip_addr = 0; >> if (odph_ipv4_addr_parse(&ip_addr, "001.002.003.004")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_ipv4(&ip_addr, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> /* Not zero pre-fixed */ >> ip_addr = 0; >> if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_ipv4(&ip_addr, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> /* String may continue with other chars */ >> ip_addr = 0; >> if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4 foobar")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_ipv4(&ip_addr, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> @@ -292,12 +292,12 @@ static int test_ipv4(void) >> /* Dual digits */ >> ip_addr = 0; >> if (odph_ipv4_addr_parse(&ip_addr, "26.43.60.77")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_ipv4(&ip_addr, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> @@ -306,12 +306,12 @@ static int test_ipv4(void) >> /* Triple digits */ >> ip_addr = 0; >> if (odph_ipv4_addr_parse(&ip_addr, "161.178.195.212")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_ipv4(&ip_addr, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> @@ -320,12 +320,12 @@ static int test_ipv4(void) >> /* All zeros */ >> ip_addr = 0; >> if (odph_ipv4_addr_parse(&ip_addr, "0.0.0.0")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_ipv4(&ip_addr, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> @@ -334,12 +334,12 @@ static int test_ipv4(void) >> /* All ones */ >> ip_addr = 0; >> if (odph_ipv4_addr_parse(&ip_addr, "255.255.255.255")) { >> - LOG_ERR("Parse call failed\n"); >> + ODPH_ERR("Parse call failed\n"); >> return -1; >> } >> >> if (different_ipv4(&ip_addr, &ref)) { >> - LOG_ERR("Bad parse result\n"); >> + ODPH_ERR("Bad parse result\n"); >> return -1; >> } >> >> diff --git a/helper/test/table.c b/helper/test/table.c >> index abb5b3b..3b74b22 100644 >> --- a/helper/test/table.c >> +++ b/helper/test/table.c >> @@ -4,7 +4,7 @@ >> * SPDX-License-Identifier:BSD-3-Clause >> */ >> >> -#include <test_debug.h> >> +#include <odph_debug.h> >> #include <../odph_hashtable.h> >> #include <../odph_lineartable.h> >> #include <odp_api.h> >> @@ -25,7 +25,7 @@ >> * value (data): MAC address of the next hop station (6 bytes). >> */ >> >> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >> { >> odp_instance_t instance; >> int ret = 0; >> @@ -43,12 +43,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> >> ret = odp_init_global(&instance, NULL, NULL); >> if (ret != 0) { >> - LOG_ERR("odp_shm_init_global fail\n"); >> + ODPH_ERR("odp_shm_init_global fail\n"); >> exit(EXIT_FAILURE); >> } >> ret = odp_init_local(instance, ODP_THREAD_WORKER); >> if (ret != 0) { >> - LOG_ERR("odp_shm_init_local fail\n"); >> + ODPH_ERR("odp_shm_init_local fail\n"); >> exit(EXIT_FAILURE); >> } >> >> @@ -121,12 +121,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >> printf("all test finished success!!\n"); >> >> if (odp_term_local()) { >> - LOG_ERR("Error: ODP local term failed.\n"); >> + ODPH_ERR("Error: ODP local term failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> if (odp_term_global(instance)) { >> - LOG_ERR("Error: ODP global term failed.\n"); >> + ODPH_ERR("Error: ODP global term failed.\n"); >> exit(EXIT_FAILURE); >> } >> >> > -- Mike Holmes Program Manager - Linaro Networking Group Linaro.org │ Open source software for ARM SoCs "Work should be fun and collaborative, the rest follows"
On 01/19/17 19:01, Mike Holmes wrote: > On 19 January 2017 at 09:45, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: >> On 01/19/17 01:01, Mike Holmes wrote: >>> There is no reason that the helpers need to depend on the test directory >>> so remove the offending links >>> >>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org> >>> --- >>> helper/test/Makefile.am | 26 ++++++++--- >>> helper/test/chksum.c | 18 ++++---- >>> helper/test/cuckootable.c | 4 +- >>> helper/test/iplookuptable.c | 4 +- >>> helper/test/linux-generic/process.c | 14 +++--- >>> helper/test/linux-generic/thread.c | 14 +++--- >>> helper/test/odpthreads.c | 18 ++++---- >>> helper/test/parse.c | 86 ++++++++++++++++++------------------- >>> helper/test/table.c | 12 +++--- >>> 9 files changed, 106 insertions(+), 90 deletions(-) >>> >>> diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am >>> index 7d55ae6..8d5bc9d 100644 >>> --- a/helper/test/Makefile.am >>> +++ b/helper/test/Makefile.am >>> @@ -1,10 +1,27 @@ >>> -include $(top_srcdir)/test/Makefile.inc >>> +include $(top_srcdir)/platform/@with_platform@/Makefile.inc >>> >>> -AM_CFLAGS += -I$(srcdir)/common >>> +LIB = $(top_builddir)/lib >>> + >>> +#in the following line, the libs using the symbols should come before >>> +#the libs containing them! The includer is given a chance to add things >>> +#before libodp by setting PRE_LDADD before the inclusion. >>> +LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la >>> + >> >> LIBDIR is better name here, but might be it too long and you will have >> to write that in 2 lines. In that case might be reasonable to use >> directly $(top_builddir) > > > It might be a better name but it would need a global change or it > woudl not follow the pattern form other files > > mike@mike-desktop:~/work/git/odp$ git grep LDADD | wc -l > 35 > > There are 35 uses of this VARIABLE so I think that is better done globally > why grep LDADD and not LIB? I tried to sat about LIB has to be LIBDIR and it's local to that file and used only in 2 places and $(top_builddir)/lib can be used here. Maxim. > >> >> >>> +INCFLAGS = \ >>> + -I$(top_builddir)/platform/@with_platform@/include \ >>> + -I$(top_srcdir)/helper/include \ >>> + -I$(top_srcdir)/helper/platform/@with_helper_platform@/include \ >>> + -I$(top_srcdir)/include \ >>> + -I$(top_srcdir)/platform/@with_platform@/include \ >>> + -I$(top_builddir)/include \ >>> + -I$(top_srcdir)/helper >>> + >>> +ODP_PLATFORM=${with_platform} >>> + >>> +AM_CFLAGS += $(INCFLAGS) >>> +AM_CXXFLAGS = $(INCFLAGS) >> >> += here in case if some flags will be passed from ./configure ? > > Will fix > > >> >>> AM_LDFLAGS += -static >>> >>> -TESTS_ENVIRONMENT += TEST_DIR=${builddir} >>> - >>> EXECUTABLES = chksum$(EXEEXT) \ >>> cuckootable$(EXEEXT) \ >>> parse$(EXEEXT)\ >>> @@ -38,7 +55,6 @@ EXTRA_DIST = odpthreads_as_processes odpthreads_as_pthreads >>> dist_chksum_SOURCES = chksum.c >>> dist_cuckootable_SOURCES = cuckootable.c >>> dist_odpthreads_SOURCES = odpthreads.c >>> -odpthreads_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la >>> dist_parse_SOURCES = parse.c >>> dist_table_SOURCES = table.c >>> dist_iplookuptable_SOURCES = iplookuptable.c >>> diff --git a/helper/test/chksum.c b/helper/test/chksum.c >>> index 749d495..7c572ae 100644 >>> --- a/helper/test/chksum.c >>> +++ b/helper/test/chksum.c >>> @@ -4,7 +4,7 @@ >>> * SPDX-License-Identifier: BSD-3-Clause >>> */ >>> >>> -#include <test_debug.h> >>> +#include "odph_debug.h" >>> #include <odp_api.h> >>> #include <odp/helper/eth.h> >>> #include <odp/helper/ip.h> >>> @@ -21,7 +21,7 @@ struct udata_struct { >>> }; >>> >>> /* Create additional dataplane threads */ >>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>> { >>> odp_instance_t instance; >>> int status = 0; >>> @@ -41,17 +41,17 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> odp_pool_capability_t capa; >>> >>> if (odp_init_global(&instance, NULL, NULL)) { >>> - LOG_ERR("Error: ODP global init failed.\n"); >>> + ODPH_ERR("Error: ODP global init failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> if (odp_init_local(instance, ODP_THREAD_WORKER)) { >>> - LOG_ERR("Error: ODP local init failed.\n"); >>> + ODPH_ERR("Error: ODP local init failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> if (odp_pool_capability(&capa) < 0) { >>> - LOG_ERR("Error: ODP global init failed.\n"); >>> + ODPH_ERR("Error: ODP global init failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> @@ -91,12 +91,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); >>> >>> if (odph_ipv4_addr_parse(&dstip, "192.168.0.1")) { >>> - LOG_ERR("Error: parse ip\n"); >>> + ODPH_ERR("Error: parse ip\n"); >>> return -1; >>> } >>> >>> if (odph_ipv4_addr_parse(&srcip, "192.168.0.2")) { >>> - LOG_ERR("Error: parse ip\n"); >>> + ODPH_ERR("Error: parse ip\n"); >>> return -1; >>> } >>> >>> @@ -139,12 +139,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> return -1; >>> >>> if (odp_term_local()) { >>> - LOG_ERR("Error: ODP local term failed.\n"); >>> + ODPH_ERR("Error: ODP local term failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> if (odp_term_global(instance)) { >>> - LOG_ERR("Error: ODP global term failed.\n"); >>> + ODPH_ERR("Error: ODP global term failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c >>> index 5b4333b..6736f2b 100644 >>> --- a/helper/test/cuckootable.c >>> +++ b/helper/test/cuckootable.c >>> @@ -48,7 +48,7 @@ >>> #include <time.h> >>> >>> #include <odp_api.h> >>> -#include <test_debug.h> >>> +#include <odph_debug.h> >>> #include <../odph_cuckootable.h> >>> >>> /******************************************************************************* >>> @@ -534,7 +534,7 @@ test_cuckoo_hash_table(void) >>> return 0; >>> } >>> >>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>> { >>> odp_instance_t instance; >>> int ret = 0; >>> diff --git a/helper/test/iplookuptable.c b/helper/test/iplookuptable.c >>> index e1d2820..86aa1b3 100644 >>> --- a/helper/test/iplookuptable.c >>> +++ b/helper/test/iplookuptable.c >>> @@ -11,7 +11,7 @@ >>> #include <errno.h> >>> >>> #include <odp_api.h> >>> -#include <test_debug.h> >>> +#include <odph_debug.h> >>> #include <../odph_iplookuptable.h> >>> #include <odp/helper/ip.h> >>> >>> @@ -138,7 +138,7 @@ static int test_ip_lookup_table(void) >>> return 0; >>> } >>> >>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>> { >>> odp_instance_t instance; >>> int ret = 0; >>> diff --git a/helper/test/linux-generic/process.c b/helper/test/linux-generic/process.c >>> index f641128..f9bdc3e 100644 >>> --- a/helper/test/linux-generic/process.c >>> +++ b/helper/test/linux-generic/process.c >>> @@ -4,13 +4,13 @@ >>> * SPDX-License-Identifier: BSD-3-Clause >>> */ >>> >>> -#include <test_debug.h> >>> +#include <odph_debug.h> >>> #include <odp_api.h> >>> #include <odp/helper/platform/linux-generic/threads_extn.h> >>> >>> #define NUMBER_WORKERS 16 /* 0 = max */ >>> >>> -static void *worker_fn(void *arg TEST_UNUSED) >>> +static void *worker_fn(void *arg ODPH_UNUSED) >>> { >>> /* depend on the odp helper to call odp_init_local */ >>> printf("Worker thread on CPU %d\n", odp_cpu_id()); >>> @@ -19,7 +19,7 @@ static void *worker_fn(void *arg TEST_UNUSED) >>> } >>> >>> /* Create additional dataplane processes */ >>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>> { >>> odp_cpumask_t cpu_mask; >>> int num_workers; >>> @@ -31,12 +31,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> odph_linux_thr_params_t thr_params; >>> >>> if (odp_init_global(&instance, NULL, NULL)) { >>> - LOG_ERR("Error: ODP global init failed.\n"); >>> + ODPH_ERR("Error: ODP global init failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> if (odp_init_local(instance, ODP_THREAD_CONTROL)) { >>> - LOG_ERR("Error: ODP local init failed.\n"); >>> + ODPH_ERR("Error: ODP local init failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> @@ -71,7 +71,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> ret = odph_linux_process_fork_n(proc, &cpu_mask, &thr_params); >>> >>> if (ret < 0) { >>> - LOG_ERR("Fork workers failed %i\n", ret); >>> + ODPH_ERR("Fork workers failed %i\n", ret); >>> return -1; >>> } >>> >>> @@ -83,7 +83,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> odph_linux_process_wait_n(proc, num_workers); >>> >>> if (odp_term_global(instance)) { >>> - LOG_ERR("Error: ODP global term failed.\n"); >>> + ODPH_ERR("Error: ODP global term failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> } >>> diff --git a/helper/test/linux-generic/thread.c b/helper/test/linux-generic/thread.c >>> index f1ca1b7..919f00e 100644 >>> --- a/helper/test/linux-generic/thread.c >>> +++ b/helper/test/linux-generic/thread.c >>> @@ -4,12 +4,12 @@ >>> * SPDX-License-Identifier: BSD-3-Clause >>> */ >>> >>> -#include <test_debug.h> >>> +#include <odph_debug.h> >>> #include <odp_api.h> >>> #include <odp/helper/platform/linux-generic/threads_extn.h> >>> >>> #define NUMBER_WORKERS 16 >>> -static void *worker_fn(void *arg TEST_UNUSED) >>> +static void *worker_fn(void *arg ODPH_UNUSED) >>> { >>> /* depend on the odp helper to call odp_init_local */ >>> >>> @@ -21,7 +21,7 @@ static void *worker_fn(void *arg TEST_UNUSED) >>> } >>> >>> /* Create additional dataplane threads */ >>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>> { >>> odph_linux_pthread_t thread_tbl[NUMBER_WORKERS]; >>> odp_cpumask_t cpu_mask; >>> @@ -32,12 +32,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> odph_linux_thr_params_t thr_params; >>> >>> if (odp_init_global(&instance, NULL, NULL)) { >>> - LOG_ERR("Error: ODP global init failed.\n"); >>> + ODPH_ERR("Error: ODP global init failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> if (odp_init_local(instance, ODP_THREAD_CONTROL)) { >>> - LOG_ERR("Error: ODP local init failed.\n"); >>> + ODPH_ERR("Error: ODP local init failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> @@ -74,12 +74,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> odph_linux_pthread_join(thread_tbl, num_workers); >>> >>> if (odp_term_local()) { >>> - LOG_ERR("Error: ODP local term failed.\n"); >>> + ODPH_ERR("Error: ODP local term failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> if (odp_term_global(instance)) { >>> - LOG_ERR("Error: ODP global term failed.\n"); >>> + ODPH_ERR("Error: ODP global term failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c >>> index 216bccd..4bb3c3b 100644 >>> --- a/helper/test/odpthreads.c >>> +++ b/helper/test/odpthreads.c >>> @@ -13,7 +13,7 @@ >>> #include <unistd.h> >>> #include <stdlib.h> >>> >>> -#include <test_debug.h> >>> +#include <odph_debug.h> >>> #include <odp_api.h> >>> #include <odp/helper/threads.h> >>> >>> @@ -25,7 +25,7 @@ static void main_exit(void); >>> /* ODP application instance */ >>> static odp_instance_t odp_instance; >>> >>> -static int worker_fn(void *arg TEST_UNUSED) >>> +static int worker_fn(void *arg ODPH_UNUSED) >>> { >>> int cpu; >>> odp_cpumask_t workers; >>> @@ -74,12 +74,12 @@ int main(int argc, char *argv[]) >>> odph_parse_options(argc, argv, NULL, NULL); >>> >>> if (odp_init_global(&odp_instance, NULL, NULL)) { >>> - LOG_ERR("Error: ODP global init failed.\n"); >>> + ODPH_ERR("Error: ODP global init failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> if (odp_init_local(odp_instance, ODP_THREAD_CONTROL)) { >>> - LOG_ERR("Error: ODP local init failed.\n"); >>> + ODPH_ERR("Error: ODP local init failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> @@ -89,13 +89,13 @@ int main(int argc, char *argv[]) >>> odp_cpumask_zero(&cpu_mask); >>> /* allocate the 1st available control cpu to main process */ >>> if (odp_cpumask_default_control(&cpu_mask, 1) != 1) { >>> - LOG_ERR("Allocate main process CPU core failed.\n"); >>> + ODPH_ERR("Allocate main process CPU core failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> cpu = odp_cpumask_first(&cpu_mask); >>> if (odph_odpthread_setaffinity(cpu) != 0) { >>> - LOG_ERR("Set main process affinify to " >>> + ODPH_ERR("Set main process affinify to " >>> "cpu(%d) failed.\n", cpu); >>> exit(EXIT_FAILURE); >>> } >>> @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) >>> /* read back affinity to verify */ >>> affinity = odph_odpthread_getaffinity(); >>> if ((affinity < 0) || (cpu != affinity)) { >>> - LOG_ERR("Verify main process affinity failed: " >>> + ODPH_ERR("Verify main process affinity failed: " >>> "set(%d) read(%d).\n", cpu, affinity); >>> exit(EXIT_FAILURE); >>> } >>> @@ -152,12 +152,12 @@ int main(int argc, char *argv[]) >>> static void main_exit(void) >>> { >>> if (odp_term_local()) { >>> - LOG_ERR("Error: ODP local term failed.\n"); >>> + ODPH_ERR("Error: ODP local term failed.\n"); >>> _exit(EXIT_FAILURE); >>> } >>> >>> if (odp_term_global(odp_instance)) { >>> - LOG_ERR("Error: ODP global term failed.\n"); >>> + ODPH_ERR("Error: ODP global term failed.\n"); >>> _exit(EXIT_FAILURE); >>> } >>> } >>> diff --git a/helper/test/parse.c b/helper/test/parse.c >>> index b5a4ab4..26dfc68 100644 >>> --- a/helper/test/parse.c >>> +++ b/helper/test/parse.c >>> @@ -4,7 +4,7 @@ >>> * SPDX-License-Identifier: BSD-3-Clause >>> */ >>> >>> -#include <test_debug.h> >>> +#include <odph_debug.h> >>> >>> #include <odp_api.h> >>> #include <odp/helper/eth.h> >>> @@ -42,37 +42,37 @@ static int test_mac(void) >>> >>> /* String must not start with other chars */ >>> if (!odph_eth_addr_parse(&mac, "foo 01:02:03:04:05:06")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Missing digit */ >>> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Missing colon */ >>> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05 06")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Too large value */ >>> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:1ff")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Negative value */ >>> if (!odph_eth_addr_parse(&mac, "-1:02:03:04:05:06")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Failed function call must not store address */ >>> if (different_mac(&mac, &ref)) { >>> - LOG_ERR("Modified address when failed\n"); >>> + ODPH_ERR("Modified address when failed\n"); >>> return -1; >>> } >>> >>> @@ -86,36 +86,36 @@ static int test_mac(void) >>> /* Zero pre-fixed */ >>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>> if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_mac(&mac, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> /* Not zero pre-fixed */ >>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>> if (odph_eth_addr_parse(&mac, "1:2:3:4:5:6")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_mac(&mac, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> /* String may continue with other chars */ >>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>> if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06 foobar")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_mac(&mac, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> @@ -129,24 +129,24 @@ static int test_mac(void) >>> /* Zero pre-fixed */ >>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>> if (odph_eth_addr_parse(&mac, "0a:0b:0c:0d:0e:0f")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_mac(&mac, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> /* Not zero pre-fixed */ >>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>> if (odph_eth_addr_parse(&mac, "a:b:c:d:e:f")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_mac(&mac, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> @@ -160,12 +160,12 @@ static int test_mac(void) >>> /* Dual digits */ >>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>> if (odph_eth_addr_parse(&mac, "1a:2b:3c:4d:5e:6f")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_mac(&mac, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> @@ -174,12 +174,12 @@ static int test_mac(void) >>> /* All zeros */ >>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>> if (odph_eth_addr_parse(&mac, "00:00:00:00:00:00")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_mac(&mac, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> @@ -188,12 +188,12 @@ static int test_mac(void) >>> /* All ones */ >>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>> if (odph_eth_addr_parse(&mac, "ff:ff:ff:ff:ff:ff")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_mac(&mac, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> @@ -215,37 +215,37 @@ static int test_ipv4(void) >>> >>> /* String must not start with other chars */ >>> if (!odph_ipv4_addr_parse(&ip_addr, "foo 1.2.3.4")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Missing digit */ >>> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Missing dot */ >>> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3 4")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Too large value */ >>> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.256")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Negative value */ >>> if (!odph_ipv4_addr_parse(&ip_addr, "-1.2.3.4")) { >>> - LOG_ERR("Accepted bad string\n"); >>> + ODPH_ERR("Accepted bad string\n"); >>> return -1; >>> } >>> >>> /* Failed function call must not store address */ >>> if (different_ipv4(&ip_addr, &ref)) { >>> - LOG_ERR("Modified address when failed\n"); >>> + ODPH_ERR("Modified address when failed\n"); >>> return -1; >>> } >>> >>> @@ -254,36 +254,36 @@ static int test_ipv4(void) >>> /* Zero pre-fixed */ >>> ip_addr = 0; >>> if (odph_ipv4_addr_parse(&ip_addr, "001.002.003.004")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_ipv4(&ip_addr, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> /* Not zero pre-fixed */ >>> ip_addr = 0; >>> if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_ipv4(&ip_addr, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> /* String may continue with other chars */ >>> ip_addr = 0; >>> if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4 foobar")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_ipv4(&ip_addr, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> @@ -292,12 +292,12 @@ static int test_ipv4(void) >>> /* Dual digits */ >>> ip_addr = 0; >>> if (odph_ipv4_addr_parse(&ip_addr, "26.43.60.77")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_ipv4(&ip_addr, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> @@ -306,12 +306,12 @@ static int test_ipv4(void) >>> /* Triple digits */ >>> ip_addr = 0; >>> if (odph_ipv4_addr_parse(&ip_addr, "161.178.195.212")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_ipv4(&ip_addr, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> @@ -320,12 +320,12 @@ static int test_ipv4(void) >>> /* All zeros */ >>> ip_addr = 0; >>> if (odph_ipv4_addr_parse(&ip_addr, "0.0.0.0")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_ipv4(&ip_addr, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> @@ -334,12 +334,12 @@ static int test_ipv4(void) >>> /* All ones */ >>> ip_addr = 0; >>> if (odph_ipv4_addr_parse(&ip_addr, "255.255.255.255")) { >>> - LOG_ERR("Parse call failed\n"); >>> + ODPH_ERR("Parse call failed\n"); >>> return -1; >>> } >>> >>> if (different_ipv4(&ip_addr, &ref)) { >>> - LOG_ERR("Bad parse result\n"); >>> + ODPH_ERR("Bad parse result\n"); >>> return -1; >>> } >>> >>> diff --git a/helper/test/table.c b/helper/test/table.c >>> index abb5b3b..3b74b22 100644 >>> --- a/helper/test/table.c >>> +++ b/helper/test/table.c >>> @@ -4,7 +4,7 @@ >>> * SPDX-License-Identifier:BSD-3-Clause >>> */ >>> >>> -#include <test_debug.h> >>> +#include <odph_debug.h> >>> #include <../odph_hashtable.h> >>> #include <../odph_lineartable.h> >>> #include <odp_api.h> >>> @@ -25,7 +25,7 @@ >>> * value (data): MAC address of the next hop station (6 bytes). >>> */ >>> >>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>> { >>> odp_instance_t instance; >>> int ret = 0; >>> @@ -43,12 +43,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> >>> ret = odp_init_global(&instance, NULL, NULL); >>> if (ret != 0) { >>> - LOG_ERR("odp_shm_init_global fail\n"); >>> + ODPH_ERR("odp_shm_init_global fail\n"); >>> exit(EXIT_FAILURE); >>> } >>> ret = odp_init_local(instance, ODP_THREAD_WORKER); >>> if (ret != 0) { >>> - LOG_ERR("odp_shm_init_local fail\n"); >>> + ODPH_ERR("odp_shm_init_local fail\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> @@ -121,12 +121,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>> printf("all test finished success!!\n"); >>> >>> if (odp_term_local()) { >>> - LOG_ERR("Error: ODP local term failed.\n"); >>> + ODPH_ERR("Error: ODP local term failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> if (odp_term_global(instance)) { >>> - LOG_ERR("Error: ODP global term failed.\n"); >>> + ODPH_ERR("Error: ODP global term failed.\n"); >>> exit(EXIT_FAILURE); >>> } >>> >>> >> > > >
On 19 January 2017 at 12:19, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > On 01/19/17 19:01, Mike Holmes wrote: >> On 19 January 2017 at 09:45, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: >>> On 01/19/17 01:01, Mike Holmes wrote: >>>> There is no reason that the helpers need to depend on the test directory >>>> so remove the offending links >>>> >>>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org> >>>> --- >>>> helper/test/Makefile.am | 26 ++++++++--- >>>> helper/test/chksum.c | 18 ++++---- >>>> helper/test/cuckootable.c | 4 +- >>>> helper/test/iplookuptable.c | 4 +- >>>> helper/test/linux-generic/process.c | 14 +++--- >>>> helper/test/linux-generic/thread.c | 14 +++--- >>>> helper/test/odpthreads.c | 18 ++++---- >>>> helper/test/parse.c | 86 ++++++++++++++++++------------------- >>>> helper/test/table.c | 12 +++--- >>>> 9 files changed, 106 insertions(+), 90 deletions(-) >>>> >>>> diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am >>>> index 7d55ae6..8d5bc9d 100644 >>>> --- a/helper/test/Makefile.am >>>> +++ b/helper/test/Makefile.am >>>> @@ -1,10 +1,27 @@ >>>> -include $(top_srcdir)/test/Makefile.inc >>>> +include $(top_srcdir)/platform/@with_platform@/Makefile.inc >>>> >>>> -AM_CFLAGS += -I$(srcdir)/common >>>> +LIB = $(top_builddir)/lib >>>> + >>>> +#in the following line, the libs using the symbols should come before >>>> +#the libs containing them! The includer is given a chance to add things >>>> +#before libodp by setting PRE_LDADD before the inclusion. >>>> +LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la >>>> + >>> >>> LIBDIR is better name here, but might be it too long and you will have >>> to write that in 2 lines. In that case might be reasonable to use >>> directly $(top_builddir) >> >> >> It might be a better name but it would need a global change or it >> woudl not follow the pattern form other files >> >> mike@mike-desktop:~/work/git/odp$ git grep LDADD | wc -l >> 35 >> >> There are 35 uses of this VARIABLE so I think that is better done globally >> > > why grep LDADD and not LIB? I tried to sat about LIB has to be LIBDIR > and it's local to that file and used only in 2 places and > $(top_builddir)/lib can be used here. Because LDADD is a cut and paste from how this is done else where, that is the variable you suggest changing, but I don't want to unify everything with this patch. We obviously accepted the name before, I have no issue reviewing a patch to globally change it all over to a better name later, but that will obscure the intent here. e.g. test/Makefile.inc:LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la traffic_mngr_main_LDADD = libtesttraffic_mngr.la -lm $(LIBCUNIT_COMMON) $(LIBODP) .. ... > > Maxim. > > > >> >>> >>> >>>> +INCFLAGS = \ >>>> + -I$(top_builddir)/platform/@with_platform@/include \ >>>> + -I$(top_srcdir)/helper/include \ >>>> + -I$(top_srcdir)/helper/platform/@with_helper_platform@/include \ >>>> + -I$(top_srcdir)/include \ >>>> + -I$(top_srcdir)/platform/@with_platform@/include \ >>>> + -I$(top_builddir)/include \ >>>> + -I$(top_srcdir)/helper >>>> + >>>> +ODP_PLATFORM=${with_platform} >>>> + >>>> +AM_CFLAGS += $(INCFLAGS) >>>> +AM_CXXFLAGS = $(INCFLAGS) >>> >>> += here in case if some flags will be passed from ./configure ? >> >> Will fix >> >> >>> >>>> AM_LDFLAGS += -static >>>> >>>> -TESTS_ENVIRONMENT += TEST_DIR=${builddir} >>>> - >>>> EXECUTABLES = chksum$(EXEEXT) \ >>>> cuckootable$(EXEEXT) \ >>>> parse$(EXEEXT)\ >>>> @@ -38,7 +55,6 @@ EXTRA_DIST = odpthreads_as_processes odpthreads_as_pthreads >>>> dist_chksum_SOURCES = chksum.c >>>> dist_cuckootable_SOURCES = cuckootable.c >>>> dist_odpthreads_SOURCES = odpthreads.c >>>> -odpthreads_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la >>>> dist_parse_SOURCES = parse.c >>>> dist_table_SOURCES = table.c >>>> dist_iplookuptable_SOURCES = iplookuptable.c >>>> diff --git a/helper/test/chksum.c b/helper/test/chksum.c >>>> index 749d495..7c572ae 100644 >>>> --- a/helper/test/chksum.c >>>> +++ b/helper/test/chksum.c >>>> @@ -4,7 +4,7 @@ >>>> * SPDX-License-Identifier: BSD-3-Clause >>>> */ >>>> >>>> -#include <test_debug.h> >>>> +#include "odph_debug.h" >>>> #include <odp_api.h> >>>> #include <odp/helper/eth.h> >>>> #include <odp/helper/ip.h> >>>> @@ -21,7 +21,7 @@ struct udata_struct { >>>> }; >>>> >>>> /* Create additional dataplane threads */ >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>>> { >>>> odp_instance_t instance; >>>> int status = 0; >>>> @@ -41,17 +41,17 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> odp_pool_capability_t capa; >>>> >>>> if (odp_init_global(&instance, NULL, NULL)) { >>>> - LOG_ERR("Error: ODP global init failed.\n"); >>>> + ODPH_ERR("Error: ODP global init failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> if (odp_init_local(instance, ODP_THREAD_WORKER)) { >>>> - LOG_ERR("Error: ODP local init failed.\n"); >>>> + ODPH_ERR("Error: ODP local init failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> if (odp_pool_capability(&capa) < 0) { >>>> - LOG_ERR("Error: ODP global init failed.\n"); >>>> + ODPH_ERR("Error: ODP global init failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> @@ -91,12 +91,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); >>>> >>>> if (odph_ipv4_addr_parse(&dstip, "192.168.0.1")) { >>>> - LOG_ERR("Error: parse ip\n"); >>>> + ODPH_ERR("Error: parse ip\n"); >>>> return -1; >>>> } >>>> >>>> if (odph_ipv4_addr_parse(&srcip, "192.168.0.2")) { >>>> - LOG_ERR("Error: parse ip\n"); >>>> + ODPH_ERR("Error: parse ip\n"); >>>> return -1; >>>> } >>>> >>>> @@ -139,12 +139,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> return -1; >>>> >>>> if (odp_term_local()) { >>>> - LOG_ERR("Error: ODP local term failed.\n"); >>>> + ODPH_ERR("Error: ODP local term failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> if (odp_term_global(instance)) { >>>> - LOG_ERR("Error: ODP global term failed.\n"); >>>> + ODPH_ERR("Error: ODP global term failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c >>>> index 5b4333b..6736f2b 100644 >>>> --- a/helper/test/cuckootable.c >>>> +++ b/helper/test/cuckootable.c >>>> @@ -48,7 +48,7 @@ >>>> #include <time.h> >>>> >>>> #include <odp_api.h> >>>> -#include <test_debug.h> >>>> +#include <odph_debug.h> >>>> #include <../odph_cuckootable.h> >>>> >>>> /******************************************************************************* >>>> @@ -534,7 +534,7 @@ test_cuckoo_hash_table(void) >>>> return 0; >>>> } >>>> >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>>> { >>>> odp_instance_t instance; >>>> int ret = 0; >>>> diff --git a/helper/test/iplookuptable.c b/helper/test/iplookuptable.c >>>> index e1d2820..86aa1b3 100644 >>>> --- a/helper/test/iplookuptable.c >>>> +++ b/helper/test/iplookuptable.c >>>> @@ -11,7 +11,7 @@ >>>> #include <errno.h> >>>> >>>> #include <odp_api.h> >>>> -#include <test_debug.h> >>>> +#include <odph_debug.h> >>>> #include <../odph_iplookuptable.h> >>>> #include <odp/helper/ip.h> >>>> >>>> @@ -138,7 +138,7 @@ static int test_ip_lookup_table(void) >>>> return 0; >>>> } >>>> >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>>> { >>>> odp_instance_t instance; >>>> int ret = 0; >>>> diff --git a/helper/test/linux-generic/process.c b/helper/test/linux-generic/process.c >>>> index f641128..f9bdc3e 100644 >>>> --- a/helper/test/linux-generic/process.c >>>> +++ b/helper/test/linux-generic/process.c >>>> @@ -4,13 +4,13 @@ >>>> * SPDX-License-Identifier: BSD-3-Clause >>>> */ >>>> >>>> -#include <test_debug.h> >>>> +#include <odph_debug.h> >>>> #include <odp_api.h> >>>> #include <odp/helper/platform/linux-generic/threads_extn.h> >>>> >>>> #define NUMBER_WORKERS 16 /* 0 = max */ >>>> >>>> -static void *worker_fn(void *arg TEST_UNUSED) >>>> +static void *worker_fn(void *arg ODPH_UNUSED) >>>> { >>>> /* depend on the odp helper to call odp_init_local */ >>>> printf("Worker thread on CPU %d\n", odp_cpu_id()); >>>> @@ -19,7 +19,7 @@ static void *worker_fn(void *arg TEST_UNUSED) >>>> } >>>> >>>> /* Create additional dataplane processes */ >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>>> { >>>> odp_cpumask_t cpu_mask; >>>> int num_workers; >>>> @@ -31,12 +31,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> odph_linux_thr_params_t thr_params; >>>> >>>> if (odp_init_global(&instance, NULL, NULL)) { >>>> - LOG_ERR("Error: ODP global init failed.\n"); >>>> + ODPH_ERR("Error: ODP global init failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> if (odp_init_local(instance, ODP_THREAD_CONTROL)) { >>>> - LOG_ERR("Error: ODP local init failed.\n"); >>>> + ODPH_ERR("Error: ODP local init failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> @@ -71,7 +71,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> ret = odph_linux_process_fork_n(proc, &cpu_mask, &thr_params); >>>> >>>> if (ret < 0) { >>>> - LOG_ERR("Fork workers failed %i\n", ret); >>>> + ODPH_ERR("Fork workers failed %i\n", ret); >>>> return -1; >>>> } >>>> >>>> @@ -83,7 +83,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> odph_linux_process_wait_n(proc, num_workers); >>>> >>>> if (odp_term_global(instance)) { >>>> - LOG_ERR("Error: ODP global term failed.\n"); >>>> + ODPH_ERR("Error: ODP global term failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> } >>>> diff --git a/helper/test/linux-generic/thread.c b/helper/test/linux-generic/thread.c >>>> index f1ca1b7..919f00e 100644 >>>> --- a/helper/test/linux-generic/thread.c >>>> +++ b/helper/test/linux-generic/thread.c >>>> @@ -4,12 +4,12 @@ >>>> * SPDX-License-Identifier: BSD-3-Clause >>>> */ >>>> >>>> -#include <test_debug.h> >>>> +#include <odph_debug.h> >>>> #include <odp_api.h> >>>> #include <odp/helper/platform/linux-generic/threads_extn.h> >>>> >>>> #define NUMBER_WORKERS 16 >>>> -static void *worker_fn(void *arg TEST_UNUSED) >>>> +static void *worker_fn(void *arg ODPH_UNUSED) >>>> { >>>> /* depend on the odp helper to call odp_init_local */ >>>> >>>> @@ -21,7 +21,7 @@ static void *worker_fn(void *arg TEST_UNUSED) >>>> } >>>> >>>> /* Create additional dataplane threads */ >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>>> { >>>> odph_linux_pthread_t thread_tbl[NUMBER_WORKERS]; >>>> odp_cpumask_t cpu_mask; >>>> @@ -32,12 +32,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> odph_linux_thr_params_t thr_params; >>>> >>>> if (odp_init_global(&instance, NULL, NULL)) { >>>> - LOG_ERR("Error: ODP global init failed.\n"); >>>> + ODPH_ERR("Error: ODP global init failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> if (odp_init_local(instance, ODP_THREAD_CONTROL)) { >>>> - LOG_ERR("Error: ODP local init failed.\n"); >>>> + ODPH_ERR("Error: ODP local init failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> @@ -74,12 +74,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> odph_linux_pthread_join(thread_tbl, num_workers); >>>> >>>> if (odp_term_local()) { >>>> - LOG_ERR("Error: ODP local term failed.\n"); >>>> + ODPH_ERR("Error: ODP local term failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> if (odp_term_global(instance)) { >>>> - LOG_ERR("Error: ODP global term failed.\n"); >>>> + ODPH_ERR("Error: ODP global term failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c >>>> index 216bccd..4bb3c3b 100644 >>>> --- a/helper/test/odpthreads.c >>>> +++ b/helper/test/odpthreads.c >>>> @@ -13,7 +13,7 @@ >>>> #include <unistd.h> >>>> #include <stdlib.h> >>>> >>>> -#include <test_debug.h> >>>> +#include <odph_debug.h> >>>> #include <odp_api.h> >>>> #include <odp/helper/threads.h> >>>> >>>> @@ -25,7 +25,7 @@ static void main_exit(void); >>>> /* ODP application instance */ >>>> static odp_instance_t odp_instance; >>>> >>>> -static int worker_fn(void *arg TEST_UNUSED) >>>> +static int worker_fn(void *arg ODPH_UNUSED) >>>> { >>>> int cpu; >>>> odp_cpumask_t workers; >>>> @@ -74,12 +74,12 @@ int main(int argc, char *argv[]) >>>> odph_parse_options(argc, argv, NULL, NULL); >>>> >>>> if (odp_init_global(&odp_instance, NULL, NULL)) { >>>> - LOG_ERR("Error: ODP global init failed.\n"); >>>> + ODPH_ERR("Error: ODP global init failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> if (odp_init_local(odp_instance, ODP_THREAD_CONTROL)) { >>>> - LOG_ERR("Error: ODP local init failed.\n"); >>>> + ODPH_ERR("Error: ODP local init failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> @@ -89,13 +89,13 @@ int main(int argc, char *argv[]) >>>> odp_cpumask_zero(&cpu_mask); >>>> /* allocate the 1st available control cpu to main process */ >>>> if (odp_cpumask_default_control(&cpu_mask, 1) != 1) { >>>> - LOG_ERR("Allocate main process CPU core failed.\n"); >>>> + ODPH_ERR("Allocate main process CPU core failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> cpu = odp_cpumask_first(&cpu_mask); >>>> if (odph_odpthread_setaffinity(cpu) != 0) { >>>> - LOG_ERR("Set main process affinify to " >>>> + ODPH_ERR("Set main process affinify to " >>>> "cpu(%d) failed.\n", cpu); >>>> exit(EXIT_FAILURE); >>>> } >>>> @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) >>>> /* read back affinity to verify */ >>>> affinity = odph_odpthread_getaffinity(); >>>> if ((affinity < 0) || (cpu != affinity)) { >>>> - LOG_ERR("Verify main process affinity failed: " >>>> + ODPH_ERR("Verify main process affinity failed: " >>>> "set(%d) read(%d).\n", cpu, affinity); >>>> exit(EXIT_FAILURE); >>>> } >>>> @@ -152,12 +152,12 @@ int main(int argc, char *argv[]) >>>> static void main_exit(void) >>>> { >>>> if (odp_term_local()) { >>>> - LOG_ERR("Error: ODP local term failed.\n"); >>>> + ODPH_ERR("Error: ODP local term failed.\n"); >>>> _exit(EXIT_FAILURE); >>>> } >>>> >>>> if (odp_term_global(odp_instance)) { >>>> - LOG_ERR("Error: ODP global term failed.\n"); >>>> + ODPH_ERR("Error: ODP global term failed.\n"); >>>> _exit(EXIT_FAILURE); >>>> } >>>> } >>>> diff --git a/helper/test/parse.c b/helper/test/parse.c >>>> index b5a4ab4..26dfc68 100644 >>>> --- a/helper/test/parse.c >>>> +++ b/helper/test/parse.c >>>> @@ -4,7 +4,7 @@ >>>> * SPDX-License-Identifier: BSD-3-Clause >>>> */ >>>> >>>> -#include <test_debug.h> >>>> +#include <odph_debug.h> >>>> >>>> #include <odp_api.h> >>>> #include <odp/helper/eth.h> >>>> @@ -42,37 +42,37 @@ static int test_mac(void) >>>> >>>> /* String must not start with other chars */ >>>> if (!odph_eth_addr_parse(&mac, "foo 01:02:03:04:05:06")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Missing digit */ >>>> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Missing colon */ >>>> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05 06")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Too large value */ >>>> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:1ff")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Negative value */ >>>> if (!odph_eth_addr_parse(&mac, "-1:02:03:04:05:06")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Failed function call must not store address */ >>>> if (different_mac(&mac, &ref)) { >>>> - LOG_ERR("Modified address when failed\n"); >>>> + ODPH_ERR("Modified address when failed\n"); >>>> return -1; >>>> } >>>> >>>> @@ -86,36 +86,36 @@ static int test_mac(void) >>>> /* Zero pre-fixed */ >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>>> if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_mac(&mac, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> /* Not zero pre-fixed */ >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>>> if (odph_eth_addr_parse(&mac, "1:2:3:4:5:6")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_mac(&mac, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> /* String may continue with other chars */ >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>>> if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06 foobar")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_mac(&mac, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> @@ -129,24 +129,24 @@ static int test_mac(void) >>>> /* Zero pre-fixed */ >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>>> if (odph_eth_addr_parse(&mac, "0a:0b:0c:0d:0e:0f")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_mac(&mac, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> /* Not zero pre-fixed */ >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>>> if (odph_eth_addr_parse(&mac, "a:b:c:d:e:f")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_mac(&mac, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> @@ -160,12 +160,12 @@ static int test_mac(void) >>>> /* Dual digits */ >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>>> if (odph_eth_addr_parse(&mac, "1a:2b:3c:4d:5e:6f")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_mac(&mac, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> @@ -174,12 +174,12 @@ static int test_mac(void) >>>> /* All zeros */ >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>>> if (odph_eth_addr_parse(&mac, "00:00:00:00:00:00")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_mac(&mac, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> @@ -188,12 +188,12 @@ static int test_mac(void) >>>> /* All ones */ >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); >>>> if (odph_eth_addr_parse(&mac, "ff:ff:ff:ff:ff:ff")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_mac(&mac, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> @@ -215,37 +215,37 @@ static int test_ipv4(void) >>>> >>>> /* String must not start with other chars */ >>>> if (!odph_ipv4_addr_parse(&ip_addr, "foo 1.2.3.4")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Missing digit */ >>>> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Missing dot */ >>>> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3 4")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Too large value */ >>>> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.256")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Negative value */ >>>> if (!odph_ipv4_addr_parse(&ip_addr, "-1.2.3.4")) { >>>> - LOG_ERR("Accepted bad string\n"); >>>> + ODPH_ERR("Accepted bad string\n"); >>>> return -1; >>>> } >>>> >>>> /* Failed function call must not store address */ >>>> if (different_ipv4(&ip_addr, &ref)) { >>>> - LOG_ERR("Modified address when failed\n"); >>>> + ODPH_ERR("Modified address when failed\n"); >>>> return -1; >>>> } >>>> >>>> @@ -254,36 +254,36 @@ static int test_ipv4(void) >>>> /* Zero pre-fixed */ >>>> ip_addr = 0; >>>> if (odph_ipv4_addr_parse(&ip_addr, "001.002.003.004")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_ipv4(&ip_addr, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> /* Not zero pre-fixed */ >>>> ip_addr = 0; >>>> if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_ipv4(&ip_addr, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> /* String may continue with other chars */ >>>> ip_addr = 0; >>>> if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4 foobar")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_ipv4(&ip_addr, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> @@ -292,12 +292,12 @@ static int test_ipv4(void) >>>> /* Dual digits */ >>>> ip_addr = 0; >>>> if (odph_ipv4_addr_parse(&ip_addr, "26.43.60.77")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_ipv4(&ip_addr, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> @@ -306,12 +306,12 @@ static int test_ipv4(void) >>>> /* Triple digits */ >>>> ip_addr = 0; >>>> if (odph_ipv4_addr_parse(&ip_addr, "161.178.195.212")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_ipv4(&ip_addr, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> @@ -320,12 +320,12 @@ static int test_ipv4(void) >>>> /* All zeros */ >>>> ip_addr = 0; >>>> if (odph_ipv4_addr_parse(&ip_addr, "0.0.0.0")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_ipv4(&ip_addr, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> @@ -334,12 +334,12 @@ static int test_ipv4(void) >>>> /* All ones */ >>>> ip_addr = 0; >>>> if (odph_ipv4_addr_parse(&ip_addr, "255.255.255.255")) { >>>> - LOG_ERR("Parse call failed\n"); >>>> + ODPH_ERR("Parse call failed\n"); >>>> return -1; >>>> } >>>> >>>> if (different_ipv4(&ip_addr, &ref)) { >>>> - LOG_ERR("Bad parse result\n"); >>>> + ODPH_ERR("Bad parse result\n"); >>>> return -1; >>>> } >>>> >>>> diff --git a/helper/test/table.c b/helper/test/table.c >>>> index abb5b3b..3b74b22 100644 >>>> --- a/helper/test/table.c >>>> +++ b/helper/test/table.c >>>> @@ -4,7 +4,7 @@ >>>> * SPDX-License-Identifier:BSD-3-Clause >>>> */ >>>> >>>> -#include <test_debug.h> >>>> +#include <odph_debug.h> >>>> #include <../odph_hashtable.h> >>>> #include <../odph_lineartable.h> >>>> #include <odp_api.h> >>>> @@ -25,7 +25,7 @@ >>>> * value (data): MAC address of the next hop station (6 bytes). >>>> */ >>>> >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) >>>> { >>>> odp_instance_t instance; >>>> int ret = 0; >>>> @@ -43,12 +43,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> >>>> ret = odp_init_global(&instance, NULL, NULL); >>>> if (ret != 0) { >>>> - LOG_ERR("odp_shm_init_global fail\n"); >>>> + ODPH_ERR("odp_shm_init_global fail\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> ret = odp_init_local(instance, ODP_THREAD_WORKER); >>>> if (ret != 0) { >>>> - LOG_ERR("odp_shm_init_local fail\n"); >>>> + ODPH_ERR("odp_shm_init_local fail\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> @@ -121,12 +121,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) >>>> printf("all test finished success!!\n"); >>>> >>>> if (odp_term_local()) { >>>> - LOG_ERR("Error: ODP local term failed.\n"); >>>> + ODPH_ERR("Error: ODP local term failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> if (odp_term_global(instance)) { >>>> - LOG_ERR("Error: ODP global term failed.\n"); >>>> + ODPH_ERR("Error: ODP global term failed.\n"); >>>> exit(EXIT_FAILURE); >>>> } >>>> >>>> >>> >> >> >> > -- Mike Holmes Program Manager - Linaro Networking Group Linaro.org │ Open source software for ARM SoCs "Work should be fun and collaborative, the rest follows"
On 19 January 2017 at 21:22, Mike Holmes <mike.holmes@linaro.org> wrote: > On 19 January 2017 at 12:19, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > > On 01/19/17 19:01, Mike Holmes wrote: > >> On 19 January 2017 at 09:45, Maxim Uvarov <maxim.uvarov@linaro.org> > wrote: > >>> On 01/19/17 01:01, Mike Holmes wrote: > >>>> There is no reason that the helpers need to depend on the test > directory > >>>> so remove the offending links > >>>> > >>>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > >>>> --- > >>>> helper/test/Makefile.am | 26 ++++++++--- > >>>> helper/test/chksum.c | 18 ++++---- > >>>> helper/test/cuckootable.c | 4 +- > >>>> helper/test/iplookuptable.c | 4 +- > >>>> helper/test/linux-generic/process.c | 14 +++--- > >>>> helper/test/linux-generic/thread.c | 14 +++--- > >>>> helper/test/odpthreads.c | 18 ++++---- > >>>> helper/test/parse.c | 86 > ++++++++++++++++++------------------- > >>>> helper/test/table.c | 12 +++--- > >>>> 9 files changed, 106 insertions(+), 90 deletions(-) > >>>> > >>>> diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am > >>>> index 7d55ae6..8d5bc9d 100644 > >>>> --- a/helper/test/Makefile.am > >>>> +++ b/helper/test/Makefile.am > >>>> @@ -1,10 +1,27 @@ > >>>> -include $(top_srcdir)/test/Makefile.inc > >>>> +include $(top_srcdir)/platform/@with_platform@/Makefile.inc > >>>> > >>>> -AM_CFLAGS += -I$(srcdir)/common > >>>> +LIB = $(top_builddir)/lib > >>>> + > >>>> +#in the following line, the libs using the symbols should come before > >>>> +#the libs containing them! The includer is given a chance to add > things > >>>> +#before libodp by setting PRE_LDADD before the inclusion. > >>>> +LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la > $(LIB)/libodp-linux.la > >>>> + > >>> > >>> LIBDIR is better name here, but might be it too long and you will have > >>> to write that in 2 lines. In that case might be reasonable to use > >>> directly $(top_builddir) > >> > >> > >> It might be a better name but it would need a global change or it > >> woudl not follow the pattern form other files > >> > >> mike@mike-desktop:~/work/git/odp$ git grep LDADD | wc -l > >> 35 > >> > >> There are 35 uses of this VARIABLE so I think that is better done > globally > >> > > > > why grep LDADD and not LIB? I tried to sat about LIB has to be LIBDIR > > and it's local to that file and used only in 2 places and > > $(top_builddir)/lib can be used here. > > Because LDADD is a cut and paste from how this is done else where, > that is the variable you suggest changing, but I don't want to unify > everything with this patch. > We obviously accepted the name before, I have no issue reviewing a > patch to globally change it all over to a better name later, but that > will obscure the intent here. > > e.g. > test/Makefile.inc:LDADD = $(PRE_LDADD) > $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la > traffic_mngr_main_LDADD = libtesttraffic_mngr.la -lm > $(LIBCUNIT_COMMON) $(LIBODP) > .. > ... > > ah, ok. if there are other places where it's used than no need to rename it, especially if this patch is only move. Maxim. > > > > > Maxim. > > > > > > > >> > >>> > >>> > >>>> +INCFLAGS = \ > >>>> + -I$(top_builddir)/platform/@with_platform@/include \ > >>>> + -I$(top_srcdir)/helper/include \ > >>>> + -I$(top_srcdir)/helper/platform/@with_helper_platform@/include > \ > >>>> + -I$(top_srcdir)/include \ > >>>> + -I$(top_srcdir)/platform/@with_platform@/include \ > >>>> + -I$(top_builddir)/include \ > >>>> + -I$(top_srcdir)/helper > >>>> + > >>>> +ODP_PLATFORM=${with_platform} > >>>> + > >>>> +AM_CFLAGS += $(INCFLAGS) > >>>> +AM_CXXFLAGS = $(INCFLAGS) > >>> > >>> += here in case if some flags will be passed from ./configure ? > >> > >> Will fix > >> > >> > >>> > >>>> AM_LDFLAGS += -static > >>>> > >>>> -TESTS_ENVIRONMENT += TEST_DIR=${builddir} > >>>> - > >>>> EXECUTABLES = chksum$(EXEEXT) \ > >>>> cuckootable$(EXEEXT) \ > >>>> parse$(EXEEXT)\ > >>>> @@ -38,7 +55,6 @@ EXTRA_DIST = odpthreads_as_processes > odpthreads_as_pthreads > >>>> dist_chksum_SOURCES = chksum.c > >>>> dist_cuckootable_SOURCES = cuckootable.c > >>>> dist_odpthreads_SOURCES = odpthreads.c > >>>> -odpthreads_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la > $(LIB)/libodp-linux.la > >>>> dist_parse_SOURCES = parse.c > >>>> dist_table_SOURCES = table.c > >>>> dist_iplookuptable_SOURCES = iplookuptable.c > >>>> diff --git a/helper/test/chksum.c b/helper/test/chksum.c > >>>> index 749d495..7c572ae 100644 > >>>> --- a/helper/test/chksum.c > >>>> +++ b/helper/test/chksum.c > >>>> @@ -4,7 +4,7 @@ > >>>> * SPDX-License-Identifier: BSD-3-Clause > >>>> */ > >>>> > >>>> -#include <test_debug.h> > >>>> +#include "odph_debug.h" > >>>> #include <odp_api.h> > >>>> #include <odp/helper/eth.h> > >>>> #include <odp/helper/ip.h> > >>>> @@ -21,7 +21,7 @@ struct udata_struct { > >>>> }; > >>>> > >>>> /* Create additional dataplane threads */ > >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > >>>> { > >>>> odp_instance_t instance; > >>>> int status = 0; > >>>> @@ -41,17 +41,17 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> odp_pool_capability_t capa; > >>>> > >>>> if (odp_init_global(&instance, NULL, NULL)) { > >>>> - LOG_ERR("Error: ODP global init failed.\n"); > >>>> + ODPH_ERR("Error: ODP global init failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> if (odp_init_local(instance, ODP_THREAD_WORKER)) { > >>>> - LOG_ERR("Error: ODP local init failed.\n"); > >>>> + ODPH_ERR("Error: ODP local init failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> if (odp_pool_capability(&capa) < 0) { > >>>> - LOG_ERR("Error: ODP global init failed.\n"); > >>>> + ODPH_ERR("Error: ODP global init failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> @@ -91,12 +91,12 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); > >>>> > >>>> if (odph_ipv4_addr_parse(&dstip, "192.168.0.1")) { > >>>> - LOG_ERR("Error: parse ip\n"); > >>>> + ODPH_ERR("Error: parse ip\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (odph_ipv4_addr_parse(&srcip, "192.168.0.2")) { > >>>> - LOG_ERR("Error: parse ip\n"); > >>>> + ODPH_ERR("Error: parse ip\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -139,12 +139,12 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> return -1; > >>>> > >>>> if (odp_term_local()) { > >>>> - LOG_ERR("Error: ODP local term failed.\n"); > >>>> + ODPH_ERR("Error: ODP local term failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> if (odp_term_global(instance)) { > >>>> - LOG_ERR("Error: ODP global term failed.\n"); > >>>> + ODPH_ERR("Error: ODP global term failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c > >>>> index 5b4333b..6736f2b 100644 > >>>> --- a/helper/test/cuckootable.c > >>>> +++ b/helper/test/cuckootable.c > >>>> @@ -48,7 +48,7 @@ > >>>> #include <time.h> > >>>> > >>>> #include <odp_api.h> > >>>> -#include <test_debug.h> > >>>> +#include <odph_debug.h> > >>>> #include <../odph_cuckootable.h> > >>>> > >>>> /*********************************************************** > ******************** > >>>> @@ -534,7 +534,7 @@ test_cuckoo_hash_table(void) > >>>> return 0; > >>>> } > >>>> > >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > >>>> { > >>>> odp_instance_t instance; > >>>> int ret = 0; > >>>> diff --git a/helper/test/iplookuptable.c b/helper/test/iplookuptable.c > >>>> index e1d2820..86aa1b3 100644 > >>>> --- a/helper/test/iplookuptable.c > >>>> +++ b/helper/test/iplookuptable.c > >>>> @@ -11,7 +11,7 @@ > >>>> #include <errno.h> > >>>> > >>>> #include <odp_api.h> > >>>> -#include <test_debug.h> > >>>> +#include <odph_debug.h> > >>>> #include <../odph_iplookuptable.h> > >>>> #include <odp/helper/ip.h> > >>>> > >>>> @@ -138,7 +138,7 @@ static int test_ip_lookup_table(void) > >>>> return 0; > >>>> } > >>>> > >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > >>>> { > >>>> odp_instance_t instance; > >>>> int ret = 0; > >>>> diff --git a/helper/test/linux-generic/process.c > b/helper/test/linux-generic/process.c > >>>> index f641128..f9bdc3e 100644 > >>>> --- a/helper/test/linux-generic/process.c > >>>> +++ b/helper/test/linux-generic/process.c > >>>> @@ -4,13 +4,13 @@ > >>>> * SPDX-License-Identifier: BSD-3-Clause > >>>> */ > >>>> > >>>> -#include <test_debug.h> > >>>> +#include <odph_debug.h> > >>>> #include <odp_api.h> > >>>> #include <odp/helper/platform/linux-generic/threads_extn.h> > >>>> > >>>> #define NUMBER_WORKERS 16 /* 0 = max */ > >>>> > >>>> -static void *worker_fn(void *arg TEST_UNUSED) > >>>> +static void *worker_fn(void *arg ODPH_UNUSED) > >>>> { > >>>> /* depend on the odp helper to call odp_init_local */ > >>>> printf("Worker thread on CPU %d\n", odp_cpu_id()); > >>>> @@ -19,7 +19,7 @@ static void *worker_fn(void *arg TEST_UNUSED) > >>>> } > >>>> > >>>> /* Create additional dataplane processes */ > >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > >>>> { > >>>> odp_cpumask_t cpu_mask; > >>>> int num_workers; > >>>> @@ -31,12 +31,12 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> odph_linux_thr_params_t thr_params; > >>>> > >>>> if (odp_init_global(&instance, NULL, NULL)) { > >>>> - LOG_ERR("Error: ODP global init failed.\n"); > >>>> + ODPH_ERR("Error: ODP global init failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> if (odp_init_local(instance, ODP_THREAD_CONTROL)) { > >>>> - LOG_ERR("Error: ODP local init failed.\n"); > >>>> + ODPH_ERR("Error: ODP local init failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> @@ -71,7 +71,7 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> ret = odph_linux_process_fork_n(proc, &cpu_mask, &thr_params); > >>>> > >>>> if (ret < 0) { > >>>> - LOG_ERR("Fork workers failed %i\n", ret); > >>>> + ODPH_ERR("Fork workers failed %i\n", ret); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -83,7 +83,7 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> odph_linux_process_wait_n(proc, num_workers); > >>>> > >>>> if (odp_term_global(instance)) { > >>>> - LOG_ERR("Error: ODP global term failed.\n"); > >>>> + ODPH_ERR("Error: ODP global term failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> } > >>>> diff --git a/helper/test/linux-generic/thread.c > b/helper/test/linux-generic/thread.c > >>>> index f1ca1b7..919f00e 100644 > >>>> --- a/helper/test/linux-generic/thread.c > >>>> +++ b/helper/test/linux-generic/thread.c > >>>> @@ -4,12 +4,12 @@ > >>>> * SPDX-License-Identifier: BSD-3-Clause > >>>> */ > >>>> > >>>> -#include <test_debug.h> > >>>> +#include <odph_debug.h> > >>>> #include <odp_api.h> > >>>> #include <odp/helper/platform/linux-generic/threads_extn.h> > >>>> > >>>> #define NUMBER_WORKERS 16 > >>>> -static void *worker_fn(void *arg TEST_UNUSED) > >>>> +static void *worker_fn(void *arg ODPH_UNUSED) > >>>> { > >>>> /* depend on the odp helper to call odp_init_local */ > >>>> > >>>> @@ -21,7 +21,7 @@ static void *worker_fn(void *arg TEST_UNUSED) > >>>> } > >>>> > >>>> /* Create additional dataplane threads */ > >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > >>>> { > >>>> odph_linux_pthread_t thread_tbl[NUMBER_WORKERS]; > >>>> odp_cpumask_t cpu_mask; > >>>> @@ -32,12 +32,12 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> odph_linux_thr_params_t thr_params; > >>>> > >>>> if (odp_init_global(&instance, NULL, NULL)) { > >>>> - LOG_ERR("Error: ODP global init failed.\n"); > >>>> + ODPH_ERR("Error: ODP global init failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> if (odp_init_local(instance, ODP_THREAD_CONTROL)) { > >>>> - LOG_ERR("Error: ODP local init failed.\n"); > >>>> + ODPH_ERR("Error: ODP local init failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> @@ -74,12 +74,12 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> odph_linux_pthread_join(thread_tbl, num_workers); > >>>> > >>>> if (odp_term_local()) { > >>>> - LOG_ERR("Error: ODP local term failed.\n"); > >>>> + ODPH_ERR("Error: ODP local term failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> if (odp_term_global(instance)) { > >>>> - LOG_ERR("Error: ODP global term failed.\n"); > >>>> + ODPH_ERR("Error: ODP global term failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c > >>>> index 216bccd..4bb3c3b 100644 > >>>> --- a/helper/test/odpthreads.c > >>>> +++ b/helper/test/odpthreads.c > >>>> @@ -13,7 +13,7 @@ > >>>> #include <unistd.h> > >>>> #include <stdlib.h> > >>>> > >>>> -#include <test_debug.h> > >>>> +#include <odph_debug.h> > >>>> #include <odp_api.h> > >>>> #include <odp/helper/threads.h> > >>>> > >>>> @@ -25,7 +25,7 @@ static void main_exit(void); > >>>> /* ODP application instance */ > >>>> static odp_instance_t odp_instance; > >>>> > >>>> -static int worker_fn(void *arg TEST_UNUSED) > >>>> +static int worker_fn(void *arg ODPH_UNUSED) > >>>> { > >>>> int cpu; > >>>> odp_cpumask_t workers; > >>>> @@ -74,12 +74,12 @@ int main(int argc, char *argv[]) > >>>> odph_parse_options(argc, argv, NULL, NULL); > >>>> > >>>> if (odp_init_global(&odp_instance, NULL, NULL)) { > >>>> - LOG_ERR("Error: ODP global init failed.\n"); > >>>> + ODPH_ERR("Error: ODP global init failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> if (odp_init_local(odp_instance, ODP_THREAD_CONTROL)) { > >>>> - LOG_ERR("Error: ODP local init failed.\n"); > >>>> + ODPH_ERR("Error: ODP local init failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> @@ -89,13 +89,13 @@ int main(int argc, char *argv[]) > >>>> odp_cpumask_zero(&cpu_mask); > >>>> /* allocate the 1st available control cpu to main process */ > >>>> if (odp_cpumask_default_control(&cpu_mask, 1) != 1) { > >>>> - LOG_ERR("Allocate main process CPU core failed.\n"); > >>>> + ODPH_ERR("Allocate main process CPU core failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> cpu = odp_cpumask_first(&cpu_mask); > >>>> if (odph_odpthread_setaffinity(cpu) != 0) { > >>>> - LOG_ERR("Set main process affinify to " > >>>> + ODPH_ERR("Set main process affinify to " > >>>> "cpu(%d) failed.\n", cpu); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) > >>>> /* read back affinity to verify */ > >>>> affinity = odph_odpthread_getaffinity(); > >>>> if ((affinity < 0) || (cpu != affinity)) { > >>>> - LOG_ERR("Verify main process affinity failed: " > >>>> + ODPH_ERR("Verify main process affinity failed: " > >>>> "set(%d) read(%d).\n", cpu, affinity); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> @@ -152,12 +152,12 @@ int main(int argc, char *argv[]) > >>>> static void main_exit(void) > >>>> { > >>>> if (odp_term_local()) { > >>>> - LOG_ERR("Error: ODP local term failed.\n"); > >>>> + ODPH_ERR("Error: ODP local term failed.\n"); > >>>> _exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> if (odp_term_global(odp_instance)) { > >>>> - LOG_ERR("Error: ODP global term failed.\n"); > >>>> + ODPH_ERR("Error: ODP global term failed.\n"); > >>>> _exit(EXIT_FAILURE); > >>>> } > >>>> } > >>>> diff --git a/helper/test/parse.c b/helper/test/parse.c > >>>> index b5a4ab4..26dfc68 100644 > >>>> --- a/helper/test/parse.c > >>>> +++ b/helper/test/parse.c > >>>> @@ -4,7 +4,7 @@ > >>>> * SPDX-License-Identifier: BSD-3-Clause > >>>> */ > >>>> > >>>> -#include <test_debug.h> > >>>> +#include <odph_debug.h> > >>>> > >>>> #include <odp_api.h> > >>>> #include <odp/helper/eth.h> > >>>> @@ -42,37 +42,37 @@ static int test_mac(void) > >>>> > >>>> /* String must not start with other chars */ > >>>> if (!odph_eth_addr_parse(&mac, "foo 01:02:03:04:05:06")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Missing digit */ > >>>> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Missing colon */ > >>>> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05 06")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Too large value */ > >>>> if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:1ff")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Negative value */ > >>>> if (!odph_eth_addr_parse(&mac, "-1:02:03:04:05:06")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Failed function call must not store address */ > >>>> if (different_mac(&mac, &ref)) { > >>>> - LOG_ERR("Modified address when failed\n"); > >>>> + ODPH_ERR("Modified address when failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -86,36 +86,36 @@ static int test_mac(void) > >>>> /* Zero pre-fixed */ > >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); > >>>> if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_mac(&mac, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Not zero pre-fixed */ > >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); > >>>> if (odph_eth_addr_parse(&mac, "1:2:3:4:5:6")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_mac(&mac, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* String may continue with other chars */ > >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); > >>>> if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06 foobar")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_mac(&mac, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -129,24 +129,24 @@ static int test_mac(void) > >>>> /* Zero pre-fixed */ > >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); > >>>> if (odph_eth_addr_parse(&mac, "0a:0b:0c:0d:0e:0f")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_mac(&mac, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Not zero pre-fixed */ > >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); > >>>> if (odph_eth_addr_parse(&mac, "a:b:c:d:e:f")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_mac(&mac, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -160,12 +160,12 @@ static int test_mac(void) > >>>> /* Dual digits */ > >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); > >>>> if (odph_eth_addr_parse(&mac, "1a:2b:3c:4d:5e:6f")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_mac(&mac, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -174,12 +174,12 @@ static int test_mac(void) > >>>> /* All zeros */ > >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); > >>>> if (odph_eth_addr_parse(&mac, "00:00:00:00:00:00")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_mac(&mac, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -188,12 +188,12 @@ static int test_mac(void) > >>>> /* All ones */ > >>>> memset(&mac, 0, sizeof(odph_ethaddr_t)); > >>>> if (odph_eth_addr_parse(&mac, "ff:ff:ff:ff:ff:ff")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_mac(&mac, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -215,37 +215,37 @@ static int test_ipv4(void) > >>>> > >>>> /* String must not start with other chars */ > >>>> if (!odph_ipv4_addr_parse(&ip_addr, "foo 1.2.3.4")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Missing digit */ > >>>> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Missing dot */ > >>>> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3 4")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Too large value */ > >>>> if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.256")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Negative value */ > >>>> if (!odph_ipv4_addr_parse(&ip_addr, "-1.2.3.4")) { > >>>> - LOG_ERR("Accepted bad string\n"); > >>>> + ODPH_ERR("Accepted bad string\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Failed function call must not store address */ > >>>> if (different_ipv4(&ip_addr, &ref)) { > >>>> - LOG_ERR("Modified address when failed\n"); > >>>> + ODPH_ERR("Modified address when failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -254,36 +254,36 @@ static int test_ipv4(void) > >>>> /* Zero pre-fixed */ > >>>> ip_addr = 0; > >>>> if (odph_ipv4_addr_parse(&ip_addr, "001.002.003.004")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_ipv4(&ip_addr, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* Not zero pre-fixed */ > >>>> ip_addr = 0; > >>>> if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_ipv4(&ip_addr, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> /* String may continue with other chars */ > >>>> ip_addr = 0; > >>>> if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4 foobar")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_ipv4(&ip_addr, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -292,12 +292,12 @@ static int test_ipv4(void) > >>>> /* Dual digits */ > >>>> ip_addr = 0; > >>>> if (odph_ipv4_addr_parse(&ip_addr, "26.43.60.77")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_ipv4(&ip_addr, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -306,12 +306,12 @@ static int test_ipv4(void) > >>>> /* Triple digits */ > >>>> ip_addr = 0; > >>>> if (odph_ipv4_addr_parse(&ip_addr, "161.178.195.212")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_ipv4(&ip_addr, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -320,12 +320,12 @@ static int test_ipv4(void) > >>>> /* All zeros */ > >>>> ip_addr = 0; > >>>> if (odph_ipv4_addr_parse(&ip_addr, "0.0.0.0")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_ipv4(&ip_addr, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> @@ -334,12 +334,12 @@ static int test_ipv4(void) > >>>> /* All ones */ > >>>> ip_addr = 0; > >>>> if (odph_ipv4_addr_parse(&ip_addr, "255.255.255.255")) { > >>>> - LOG_ERR("Parse call failed\n"); > >>>> + ODPH_ERR("Parse call failed\n"); > >>>> return -1; > >>>> } > >>>> > >>>> if (different_ipv4(&ip_addr, &ref)) { > >>>> - LOG_ERR("Bad parse result\n"); > >>>> + ODPH_ERR("Bad parse result\n"); > >>>> return -1; > >>>> } > >>>> > >>>> diff --git a/helper/test/table.c b/helper/test/table.c > >>>> index abb5b3b..3b74b22 100644 > >>>> --- a/helper/test/table.c > >>>> +++ b/helper/test/table.c > >>>> @@ -4,7 +4,7 @@ > >>>> * SPDX-License-Identifier:BSD-3-Clause > >>>> */ > >>>> > >>>> -#include <test_debug.h> > >>>> +#include <odph_debug.h> > >>>> #include <../odph_hashtable.h> > >>>> #include <../odph_lineartable.h> > >>>> #include <odp_api.h> > >>>> @@ -25,7 +25,7 @@ > >>>> * value (data): MAC address of the next hop station (6 bytes). > >>>> */ > >>>> > >>>> -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) > >>>> +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) > >>>> { > >>>> odp_instance_t instance; > >>>> int ret = 0; > >>>> @@ -43,12 +43,12 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> > >>>> ret = odp_init_global(&instance, NULL, NULL); > >>>> if (ret != 0) { > >>>> - LOG_ERR("odp_shm_init_global fail\n"); > >>>> + ODPH_ERR("odp_shm_init_global fail\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> ret = odp_init_local(instance, ODP_THREAD_WORKER); > >>>> if (ret != 0) { > >>>> - LOG_ERR("odp_shm_init_local fail\n"); > >>>> + ODPH_ERR("odp_shm_init_local fail\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> @@ -121,12 +121,12 @@ int main(int argc TEST_UNUSED, char *argv[] > TEST_UNUSED) > >>>> printf("all test finished success!!\n"); > >>>> > >>>> if (odp_term_local()) { > >>>> - LOG_ERR("Error: ODP local term failed.\n"); > >>>> + ODPH_ERR("Error: ODP local term failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> if (odp_term_global(instance)) { > >>>> - LOG_ERR("Error: ODP global term failed.\n"); > >>>> + ODPH_ERR("Error: ODP global term failed.\n"); > >>>> exit(EXIT_FAILURE); > >>>> } > >>>> > >>>> > >>> > >> > >> > >> > > > > > > -- > Mike Holmes > Program Manager - Linaro Networking Group > Linaro.org │ Open source software for ARM SoCs > "Work should be fun and collaborative, the rest follows" >
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am index 7d55ae6..8d5bc9d 100644 --- a/helper/test/Makefile.am +++ b/helper/test/Makefile.am @@ -1,10 +1,27 @@ -include $(top_srcdir)/test/Makefile.inc +include $(top_srcdir)/platform/@with_platform@/Makefile.inc -AM_CFLAGS += -I$(srcdir)/common +LIB = $(top_builddir)/lib + +#in the following line, the libs using the symbols should come before +#the libs containing them! The includer is given a chance to add things +#before libodp by setting PRE_LDADD before the inclusion. +LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la + +INCFLAGS = \ + -I$(top_builddir)/platform/@with_platform@/include \ + -I$(top_srcdir)/helper/include \ + -I$(top_srcdir)/helper/platform/@with_helper_platform@/include \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/platform/@with_platform@/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/helper + +ODP_PLATFORM=${with_platform} + +AM_CFLAGS += $(INCFLAGS) +AM_CXXFLAGS = $(INCFLAGS) AM_LDFLAGS += -static -TESTS_ENVIRONMENT += TEST_DIR=${builddir} - EXECUTABLES = chksum$(EXEEXT) \ cuckootable$(EXEEXT) \ parse$(EXEEXT)\ @@ -38,7 +55,6 @@ EXTRA_DIST = odpthreads_as_processes odpthreads_as_pthreads dist_chksum_SOURCES = chksum.c dist_cuckootable_SOURCES = cuckootable.c dist_odpthreads_SOURCES = odpthreads.c -odpthreads_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la dist_parse_SOURCES = parse.c dist_table_SOURCES = table.c dist_iplookuptable_SOURCES = iplookuptable.c diff --git a/helper/test/chksum.c b/helper/test/chksum.c index 749d495..7c572ae 100644 --- a/helper/test/chksum.c +++ b/helper/test/chksum.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include <test_debug.h> +#include "odph_debug.h" #include <odp_api.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h> @@ -21,7 +21,7 @@ struct udata_struct { }; /* Create additional dataplane threads */ -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_instance_t instance; int status = 0; @@ -41,17 +41,17 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odp_pool_capability_t capa; if (odp_init_global(&instance, NULL, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } if (odp_init_local(instance, ODP_THREAD_WORKER)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } if (odp_pool_capability(&capa) < 0) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -91,12 +91,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); if (odph_ipv4_addr_parse(&dstip, "192.168.0.1")) { - LOG_ERR("Error: parse ip\n"); + ODPH_ERR("Error: parse ip\n"); return -1; } if (odph_ipv4_addr_parse(&srcip, "192.168.0.2")) { - LOG_ERR("Error: parse ip\n"); + ODPH_ERR("Error: parse ip\n"); return -1; } @@ -139,12 +139,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) return -1; if (odp_term_local()) { - LOG_ERR("Error: ODP local term failed.\n"); + ODPH_ERR("Error: ODP local term failed.\n"); exit(EXIT_FAILURE); } if (odp_term_global(instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); exit(EXIT_FAILURE); } diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c index 5b4333b..6736f2b 100644 --- a/helper/test/cuckootable.c +++ b/helper/test/cuckootable.c @@ -48,7 +48,7 @@ #include <time.h> #include <odp_api.h> -#include <test_debug.h> +#include <odph_debug.h> #include <../odph_cuckootable.h> /******************************************************************************* @@ -534,7 +534,7 @@ test_cuckoo_hash_table(void) return 0; } -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_instance_t instance; int ret = 0; diff --git a/helper/test/iplookuptable.c b/helper/test/iplookuptable.c index e1d2820..86aa1b3 100644 --- a/helper/test/iplookuptable.c +++ b/helper/test/iplookuptable.c @@ -11,7 +11,7 @@ #include <errno.h> #include <odp_api.h> -#include <test_debug.h> +#include <odph_debug.h> #include <../odph_iplookuptable.h> #include <odp/helper/ip.h> @@ -138,7 +138,7 @@ static int test_ip_lookup_table(void) return 0; } -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_instance_t instance; int ret = 0; diff --git a/helper/test/linux-generic/process.c b/helper/test/linux-generic/process.c index f641128..f9bdc3e 100644 --- a/helper/test/linux-generic/process.c +++ b/helper/test/linux-generic/process.c @@ -4,13 +4,13 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include <test_debug.h> +#include <odph_debug.h> #include <odp_api.h> #include <odp/helper/platform/linux-generic/threads_extn.h> #define NUMBER_WORKERS 16 /* 0 = max */ -static void *worker_fn(void *arg TEST_UNUSED) +static void *worker_fn(void *arg ODPH_UNUSED) { /* depend on the odp helper to call odp_init_local */ printf("Worker thread on CPU %d\n", odp_cpu_id()); @@ -19,7 +19,7 @@ static void *worker_fn(void *arg TEST_UNUSED) } /* Create additional dataplane processes */ -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_cpumask_t cpu_mask; int num_workers; @@ -31,12 +31,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odph_linux_thr_params_t thr_params; if (odp_init_global(&instance, NULL, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } @@ -71,7 +71,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) ret = odph_linux_process_fork_n(proc, &cpu_mask, &thr_params); if (ret < 0) { - LOG_ERR("Fork workers failed %i\n", ret); + ODPH_ERR("Fork workers failed %i\n", ret); return -1; } @@ -83,7 +83,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odph_linux_process_wait_n(proc, num_workers); if (odp_term_global(instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); exit(EXIT_FAILURE); } } diff --git a/helper/test/linux-generic/thread.c b/helper/test/linux-generic/thread.c index f1ca1b7..919f00e 100644 --- a/helper/test/linux-generic/thread.c +++ b/helper/test/linux-generic/thread.c @@ -4,12 +4,12 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include <test_debug.h> +#include <odph_debug.h> #include <odp_api.h> #include <odp/helper/platform/linux-generic/threads_extn.h> #define NUMBER_WORKERS 16 -static void *worker_fn(void *arg TEST_UNUSED) +static void *worker_fn(void *arg ODPH_UNUSED) { /* depend on the odp helper to call odp_init_local */ @@ -21,7 +21,7 @@ static void *worker_fn(void *arg TEST_UNUSED) } /* Create additional dataplane threads */ -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odph_linux_pthread_t thread_tbl[NUMBER_WORKERS]; odp_cpumask_t cpu_mask; @@ -32,12 +32,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odph_linux_thr_params_t thr_params; if (odp_init_global(&instance, NULL, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } @@ -74,12 +74,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odph_linux_pthread_join(thread_tbl, num_workers); if (odp_term_local()) { - LOG_ERR("Error: ODP local term failed.\n"); + ODPH_ERR("Error: ODP local term failed.\n"); exit(EXIT_FAILURE); } if (odp_term_global(instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); exit(EXIT_FAILURE); } diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c index 216bccd..4bb3c3b 100644 --- a/helper/test/odpthreads.c +++ b/helper/test/odpthreads.c @@ -13,7 +13,7 @@ #include <unistd.h> #include <stdlib.h> -#include <test_debug.h> +#include <odph_debug.h> #include <odp_api.h> #include <odp/helper/threads.h> @@ -25,7 +25,7 @@ static void main_exit(void); /* ODP application instance */ static odp_instance_t odp_instance; -static int worker_fn(void *arg TEST_UNUSED) +static int worker_fn(void *arg ODPH_UNUSED) { int cpu; odp_cpumask_t workers; @@ -74,12 +74,12 @@ int main(int argc, char *argv[]) odph_parse_options(argc, argv, NULL, NULL); if (odp_init_global(&odp_instance, NULL, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } if (odp_init_local(odp_instance, ODP_THREAD_CONTROL)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } @@ -89,13 +89,13 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); /* allocate the 1st available control cpu to main process */ if (odp_cpumask_default_control(&cpu_mask, 1) != 1) { - LOG_ERR("Allocate main process CPU core failed.\n"); + ODPH_ERR("Allocate main process CPU core failed.\n"); exit(EXIT_FAILURE); } cpu = odp_cpumask_first(&cpu_mask); if (odph_odpthread_setaffinity(cpu) != 0) { - LOG_ERR("Set main process affinify to " + ODPH_ERR("Set main process affinify to " "cpu(%d) failed.\n", cpu); exit(EXIT_FAILURE); } @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) /* read back affinity to verify */ affinity = odph_odpthread_getaffinity(); if ((affinity < 0) || (cpu != affinity)) { - LOG_ERR("Verify main process affinity failed: " + ODPH_ERR("Verify main process affinity failed: " "set(%d) read(%d).\n", cpu, affinity); exit(EXIT_FAILURE); } @@ -152,12 +152,12 @@ int main(int argc, char *argv[]) static void main_exit(void) { if (odp_term_local()) { - LOG_ERR("Error: ODP local term failed.\n"); + ODPH_ERR("Error: ODP local term failed.\n"); _exit(EXIT_FAILURE); } if (odp_term_global(odp_instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); _exit(EXIT_FAILURE); } } diff --git a/helper/test/parse.c b/helper/test/parse.c index b5a4ab4..26dfc68 100644 --- a/helper/test/parse.c +++ b/helper/test/parse.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include <test_debug.h> +#include <odph_debug.h> #include <odp_api.h> #include <odp/helper/eth.h> @@ -42,37 +42,37 @@ static int test_mac(void) /* String must not start with other chars */ if (!odph_eth_addr_parse(&mac, "foo 01:02:03:04:05:06")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Missing digit */ if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Missing colon */ if (!odph_eth_addr_parse(&mac, "01:02:03:04:05 06")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Too large value */ if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:1ff")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Negative value */ if (!odph_eth_addr_parse(&mac, "-1:02:03:04:05:06")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Failed function call must not store address */ if (different_mac(&mac, &ref)) { - LOG_ERR("Modified address when failed\n"); + ODPH_ERR("Modified address when failed\n"); return -1; } @@ -86,36 +86,36 @@ static int test_mac(void) /* Zero pre-fixed */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } /* Not zero pre-fixed */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "1:2:3:4:5:6")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } /* String may continue with other chars */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06 foobar")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } @@ -129,24 +129,24 @@ static int test_mac(void) /* Zero pre-fixed */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "0a:0b:0c:0d:0e:0f")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } /* Not zero pre-fixed */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "a:b:c:d:e:f")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } @@ -160,12 +160,12 @@ static int test_mac(void) /* Dual digits */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "1a:2b:3c:4d:5e:6f")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } @@ -174,12 +174,12 @@ static int test_mac(void) /* All zeros */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "00:00:00:00:00:00")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } @@ -188,12 +188,12 @@ static int test_mac(void) /* All ones */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "ff:ff:ff:ff:ff:ff")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } @@ -215,37 +215,37 @@ static int test_ipv4(void) /* String must not start with other chars */ if (!odph_ipv4_addr_parse(&ip_addr, "foo 1.2.3.4")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Missing digit */ if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Missing dot */ if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3 4")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Too large value */ if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.256")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Negative value */ if (!odph_ipv4_addr_parse(&ip_addr, "-1.2.3.4")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; } /* Failed function call must not store address */ if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Modified address when failed\n"); + ODPH_ERR("Modified address when failed\n"); return -1; } @@ -254,36 +254,36 @@ static int test_ipv4(void) /* Zero pre-fixed */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "001.002.003.004")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } /* Not zero pre-fixed */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } /* String may continue with other chars */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4 foobar")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } @@ -292,12 +292,12 @@ static int test_ipv4(void) /* Dual digits */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "26.43.60.77")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } @@ -306,12 +306,12 @@ static int test_ipv4(void) /* Triple digits */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "161.178.195.212")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } @@ -320,12 +320,12 @@ static int test_ipv4(void) /* All zeros */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "0.0.0.0")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } @@ -334,12 +334,12 @@ static int test_ipv4(void) /* All ones */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "255.255.255.255")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; } if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; } diff --git a/helper/test/table.c b/helper/test/table.c index abb5b3b..3b74b22 100644 --- a/helper/test/table.c +++ b/helper/test/table.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier:BSD-3-Clause */ -#include <test_debug.h> +#include <odph_debug.h> #include <../odph_hashtable.h> #include <../odph_lineartable.h> #include <odp_api.h> @@ -25,7 +25,7 @@ * value (data): MAC address of the next hop station (6 bytes). */ -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_instance_t instance; int ret = 0; @@ -43,12 +43,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) ret = odp_init_global(&instance, NULL, NULL); if (ret != 0) { - LOG_ERR("odp_shm_init_global fail\n"); + ODPH_ERR("odp_shm_init_global fail\n"); exit(EXIT_FAILURE); } ret = odp_init_local(instance, ODP_THREAD_WORKER); if (ret != 0) { - LOG_ERR("odp_shm_init_local fail\n"); + ODPH_ERR("odp_shm_init_local fail\n"); exit(EXIT_FAILURE); } @@ -121,12 +121,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) printf("all test finished success!!\n"); if (odp_term_local()) { - LOG_ERR("Error: ODP local term failed.\n"); + ODPH_ERR("Error: ODP local term failed.\n"); exit(EXIT_FAILURE); } if (odp_term_global(instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); exit(EXIT_FAILURE); }
There is no reason that the helpers need to depend on the test directory so remove the offending links Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- helper/test/Makefile.am | 26 ++++++++--- helper/test/chksum.c | 18 ++++---- helper/test/cuckootable.c | 4 +- helper/test/iplookuptable.c | 4 +- helper/test/linux-generic/process.c | 14 +++--- helper/test/linux-generic/thread.c | 14 +++--- helper/test/odpthreads.c | 18 ++++---- helper/test/parse.c | 86 ++++++++++++++++++------------------- helper/test/table.c | 12 +++--- 9 files changed, 106 insertions(+), 90 deletions(-) -- 2.9.3