@@ -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) \
parse$(EXEEXT)\
table$(EXEEXT)
@@ -35,6 +52,5 @@ EXTRA_DIST = odpthreads_as_processes odpthreads_as_pthreads
dist_chksum_SOURCES = chksum.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
@@ -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);
}
@@ -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);
}
}
@@ -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);
}
@@ -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);
}
}
@@ -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;
}
@@ -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/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 +++--- 7 files changed, 102 insertions(+), 86 deletions(-) -- 2.9.3