aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaxim Uvarov <maxim.uvarov@linaro.org>2016-04-11 17:37:12 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-04-11 18:05:13 +0300
commit23f6dbccd006b050e41495204a7b924b526b7fe8 (patch)
tree70b254085dc463524060141044e8bec7bd0dcbc8 /test
parent1a91b82fdf4b28a504db2c80ae0cbc0fbaa29fcb (diff)
parentc6833d08ca5b074de9bd10d531347fd5f3bd10cf (diff)
Merge branch 'next' into api-next
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.inc4
-rw-r--r--test/m4/configure.m433
-rw-r--r--test/m4/miscellaneous.m49
-rw-r--r--test/m4/performance.m49
-rw-r--r--test/m4/validation.m458
-rw-r--r--test/performance/odp_crypto.c3
-rw-r--r--test/performance/odp_scheduling.c48
-rw-r--r--test/validation/Makefile.inc2
-rw-r--r--test/validation/pktio/pktio.c8
9 files changed, 156 insertions, 18 deletions
diff --git a/test/Makefile.inc b/test/Makefile.inc
index 183d0a5a0..5def9235e 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -4,7 +4,7 @@ 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.la $(LIB)/libodp.la
+LDADD = $(PRE_LDADD) $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la
INCFLAGS = -I$(top_srcdir)/test \
-I$(top_srcdir)/platform/@with_platform@/include \
@@ -16,6 +16,6 @@ AM_CXXFLAGS = $(INCFLAGS)
AM_LDFLAGS += -L$(LIB)
@VALGRIND_CHECK_RULES@
-valgrind_tools = memcheck drd sgcheck
+valgrind_tools = memcheck
TESTS_ENVIRONMENT= ODP_PLATFORM=${with_platform} EXEEXT=${EXEEXT}
diff --git a/test/m4/configure.m4 b/test/m4/configure.m4
new file mode 100644
index 000000000..e5b291a0a
--- /dev/null
+++ b/test/m4/configure.m4
@@ -0,0 +1,33 @@
+m4_include([test/m4/miscellaneous.m4])
+m4_include([test/m4/performance.m4])
+m4_include([test/m4/validation.m4])
+
+AC_CONFIG_FILES([test/Makefile
+ test/miscellaneous/Makefile
+ test/performance/Makefile
+ test/validation/atomic/Makefile
+ test/validation/barrier/Makefile
+ test/validation/buffer/Makefile
+ test/validation/classification/Makefile
+ test/validation/common/Makefile
+ test/validation/config/Makefile
+ test/validation/cpumask/Makefile
+ test/validation/crypto/Makefile
+ test/validation/errno/Makefile
+ test/validation/hash/Makefile
+ test/validation/init/Makefile
+ test/validation/lock/Makefile
+ test/validation/Makefile
+ test/validation/packet/Makefile
+ test/validation/pktio/Makefile
+ test/validation/pool/Makefile
+ test/validation/queue/Makefile
+ test/validation/random/Makefile
+ test/validation/scheduler/Makefile
+ test/validation/shmem/Makefile
+ test/validation/std_clib/Makefile
+ test/validation/system/Makefile
+ test/validation/thread/Makefile
+ test/validation/time/Makefile
+ test/validation/timer/Makefile
+ test/validation/traffic_mngr/Makefile])
diff --git a/test/m4/miscellaneous.m4 b/test/m4/miscellaneous.m4
new file mode 100644
index 000000000..cc881edb7
--- /dev/null
+++ b/test/m4/miscellaneous.m4
@@ -0,0 +1,9 @@
+##########################################################################
+# Enable/disable test-cpp
+##########################################################################
+test_cpp=no
+AC_ARG_ENABLE([test-cpp],
+ [ --enable-test-cpp run basic test aginast cpp],
+ [if test "x$enableval" = "xyes"; then
+ test_cpp=yes
+ fi])
diff --git a/test/m4/performance.m4 b/test/m4/performance.m4
new file mode 100644
index 000000000..1e2000d97
--- /dev/null
+++ b/test/m4/performance.m4
@@ -0,0 +1,9 @@
+##########################################################################
+# Enable/disable test-perf
+##########################################################################
+test_perf=no
+AC_ARG_ENABLE([test-perf],
+ [ --enable-test-perf run test in test/performance],
+ [if test "x$enableval" = "xyes"; then
+ test_perf=yes
+ fi])
diff --git a/test/m4/validation.m4 b/test/m4/validation.m4
new file mode 100644
index 000000000..d32f675ae
--- /dev/null
+++ b/test/m4/validation.m4
@@ -0,0 +1,58 @@
+##########################################################################
+# Enable/disable Unit tests
+##########################################################################
+cunit_support=no
+test_vald=no
+AC_ARG_ENABLE([test_vald],
+ [ --enable-test-vald run test in test/validation],
+ [if test x$enableval = xyes; then
+ test_vald=yes
+ cunit_support=yes
+ fi])
+
+##########################################################################
+# Enable/disable Unit tests
+##########################################################################
+AC_ARG_ENABLE([cunit_support],
+ [ --enable-cunit-support include cunit infrastructure],
+ [if test x$enableval = xyes; then
+ cunit_support=yes
+ fi])
+
+##########################################################################
+# Set optional CUnit path
+##########################################################################
+AC_ARG_WITH([cunit-path],
+AC_HELP_STRING([--with-cunit-path=DIR path to CUnit libs and headers],
+ [(or in the default path if not specified).]),
+ [CUNIT_PATH=$withval
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$CUNIT_PATH/include"
+ AM_LDFLAGS="$AM_LDFLAGS -L$CUNIT_PATH/lib"
+ cunit_support=yes],[])
+
+##########################################################################
+# Save and set temporary compilation flags
+##########################################################################
+OLD_LDFLAGS=$LDFLAGS
+OLD_CPPFLAGS=$CPPFLAGS
+LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
+
+##########################################################################
+# Check for CUnit availability
+##########################################################################
+if test x$cunit_support = xyes
+then
+ AC_CHECK_LIB([cunit],[CU_get_error], [],
+ [AC_MSG_ERROR([CUnit libraries required])])
+ AC_CHECK_HEADERS([CUnit/Basic.h], [],
+ [AC_MSG_FAILURE(["can't find cunit headers"])])
+else
+ cunit_support=no
+fi
+
+##########################################################################
+# Restore old saved variables
+##########################################################################
+LDFLAGS=$OLD_LDFLAGS
+CPPFLAGS=$OLD_CPPFLAGS
diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c
index 57d995e29..ade9cfa8c 100644
--- a/test/performance/odp_crypto.c
+++ b/test/performance/odp_crypto.c
@@ -727,6 +727,8 @@ int main(int argc, char *argv[])
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
odp_instance_t instance;
+ memset(&cargs, 0, sizeof(cargs));
+
/* Parse and store the application arguments */
parse_args(argc, argv, &cargs);
@@ -864,6 +866,7 @@ static void parse_args(int argc, char *argv[], crypto_args_t *cargs)
usage(argv[0]);
exit(-1);
}
+ break;
case 'd':
cargs->debug_packets = 1;
break;
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index 4da29163c..6592277d1 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -806,13 +806,15 @@ int main(int argc, char *argv[])
int num_workers;
odp_cpumask_t cpumask;
odp_pool_t pool;
- odp_queue_t queue;
+ odp_queue_t plain_queue;
int i, j;
int prios;
odp_shm_t shm;
test_globals_t *globals;
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
odp_pool_param_t params;
+ int ret = 0;
+ char name[] = "sched_XX_YY";
odp_instance_t instance;
odph_linux_thr_params_t thr_params;
@@ -874,14 +876,12 @@ int main(int argc, char *argv[])
shm = odp_shm_reserve("test_globals",
sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0);
-
- globals = odp_shm_addr(shm);
-
- if (globals == NULL) {
+ if (shm == ODP_SHM_INVALID) {
LOG_ERR("Shared memory reserve failed.\n");
return -1;
}
+ globals = odp_shm_addr(shm);
memset(globals, 0, sizeof(test_globals_t));
/*
@@ -906,9 +906,9 @@ int main(int argc, char *argv[])
/*
* Create a queue for plain queue test
*/
- queue = odp_queue_create("plain_queue", NULL);
+ plain_queue = odp_queue_create("plain_queue", NULL);
- if (queue == ODP_QUEUE_INVALID) {
+ if (plain_queue == ODP_QUEUE_INVALID) {
LOG_ERR("Plain queue create failed.\n");
return -1;
}
@@ -919,13 +919,13 @@ int main(int argc, char *argv[])
prios = odp_schedule_num_prio();
for (i = 0; i < prios; i++) {
+ odp_queue_t queue;
+ odp_queue_param_t param;
+
if (i != ODP_SCHED_PRIO_HIGHEST &&
i != ODP_SCHED_PRIO_LOWEST)
continue;
- odp_queue_param_t param;
- char name[] = "sched_XX_YY";
-
name[6] = '0' + i/10;
name[7] = '0' + i - 10*(i/10);
@@ -958,7 +958,6 @@ int main(int argc, char *argv[])
thr_params.instance = instance;
if (args.proc_mode) {
- int ret;
odph_linux_process_t proc[MAX_WORKERS];
/* Fork worker processes */
@@ -991,5 +990,30 @@ int main(int argc, char *argv[])
printf("ODP example complete\n\n");
}
- return 0;
+ for (i = 0; i < prios; i++) {
+ odp_queue_t queue;
+
+ if (i != ODP_SCHED_PRIO_HIGHEST &&
+ i != ODP_SCHED_PRIO_LOWEST)
+ continue;
+
+ name[6] = '0' + i / 10;
+ name[7] = '0' + i - 10 * (i / 10);
+
+ for (j = 0; j < QUEUES_PER_PRIO; j++) {
+ name[9] = '0' + j / 10;
+ name[10] = '0' + j - 10 * (j / 10);
+
+ queue = odp_queue_lookup(name);
+ odp_queue_destroy(queue);
+ }
+ }
+
+ odp_shm_free(shm);
+ odp_queue_destroy(plain_queue);
+ odp_pool_destroy(pool);
+ odp_term_local();
+ odp_term_global(instance);
+
+ return ret;
}
diff --git a/test/validation/Makefile.inc b/test/validation/Makefile.inc
index 49efbda98..9f36f9daa 100644
--- a/test/validation/Makefile.inc
+++ b/test/validation/Makefile.inc
@@ -13,4 +13,4 @@ AM_LDFLAGS += -static
LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la
LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la
LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la
-LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp.la
+LIBODP = $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la
diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index cb403a6ea..d52a52047 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -1173,7 +1173,7 @@ void pktio_test_statistics_counters(void)
odp_packet_t pkt;
odp_packet_t tx_pkt[1000];
odp_event_t ev;
- int i, pkts, ret, alloc = 0;
+ int i, pkts, tx_pkts, ret, alloc = 0;
odp_pktout_queue_t pktout;
uint64_t wait = odp_schedule_wait_time(ODP_TIME_MSEC_IN_NS);
odp_pktio_stats_t stats[2];
@@ -1233,9 +1233,10 @@ void pktio_test_statistics_counters(void)
}
pkts += ret;
}
+ tx_pkts = pkts;
/* get */
- for (i = 0, pkts = 0; i < 1000; i++) {
+ for (i = 0, pkts = 0; i < 1000 && pkts != tx_pkts; i++) {
ev = odp_schedule(NULL, wait);
if (ev != ODP_EVENT_INVALID) {
if (odp_event_type(ev) == ODP_EVENT_PACKET) {
@@ -1247,6 +1248,8 @@ void pktio_test_statistics_counters(void)
}
}
+ CU_ASSERT(pkts == tx_pkts);
+
ret = odp_pktio_stats(pktio_tx, &stats[0]);
CU_ASSERT(ret == 0);
@@ -1268,7 +1271,6 @@ void pktio_test_statistics_counters(void)
(PKT_LEN_NORMAL * (uint64_t)pkts)));
}
- CU_ASSERT(pkts == alloc);
CU_ASSERT(0 == stats[0].in_discards);
CU_ASSERT(0 == stats[0].in_errors);
CU_ASSERT(0 == stats[0].in_unknown_protos);