From 35cf8e1ff40e3fad3d2edec4cacd9e6028245cc1 Mon Sep 17 00:00:00 2001 From: Maxim Uvarov Date: Thu, 27 Aug 2015 19:32:38 +0300 Subject: test: l2fwd: capture test fails l2fwd expects bunch of packets to be routed, test if number of packets less then 100, and report error to make check and mark test as failed. Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- test/performance/odp_l2fwd.c | 12 +++++++----- test/performance/odp_l2fwd_run | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index ce4efa8..b25b978 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -335,7 +335,7 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool, * @param timeout Number of seconds for stats calculation * */ -static void print_speed_stats(int num_workers, stats_t **thr_stats, +static int print_speed_stats(int num_workers, stats_t **thr_stats, int duration, int timeout) { uint64_t pkts, pkts_prev = 0, pps, drops, maximum_pps = 0; @@ -369,7 +369,8 @@ static void print_speed_stats(int num_workers, stats_t **thr_stats, printf("TEST RESULT: %" PRIu64 " maximum packets per second.\n", maximum_pps); - return; + + return pkts > 100 ? 0 : -1; } /** @@ -386,6 +387,7 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_pool_param_t params; + int ret; /* Init ODP before calling anything else */ if (odp_init_global(NULL, NULL)) { @@ -491,8 +493,8 @@ int main(int argc, char *argv[]) cpu = odp_cpumask_next(&cpumask, cpu); } - print_speed_stats(num_workers, stats, gbl_args->appl.time, - gbl_args->appl.accuracy); + ret = print_speed_stats(num_workers, stats, gbl_args->appl.time, + gbl_args->appl.accuracy); free(stats); exit_threads = 1; @@ -503,7 +505,7 @@ int main(int argc, char *argv[]) free(gbl_args->appl.if_str); printf("Exit\n\n"); - return 0; + return ret; } /** diff --git a/test/performance/odp_l2fwd_run b/test/performance/odp_l2fwd_run index c20a3e1..e0c61e7 100755 --- a/test/performance/odp_l2fwd_run +++ b/test/performance/odp_l2fwd_run @@ -63,6 +63,7 @@ run_l2fwd() echo "Run odp_l2fwd -i $IF1,$IF2 -m 0 -t 30 -c 2" odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2 + ret=$? kill ${GEN_PID} @@ -72,7 +73,7 @@ run_l2fwd() exit $TEST_SKIPPED fi - exit 0 + exit $ret } case "$1" in -- cgit v1.2.3