diff mbox

[1/2] test: l2fwd: capture test fails

Message ID 1440692327-8123-2-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Aug. 27, 2015, 4:18 p.m. UTC
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.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 test/performance/odp_l2fwd.c   | 12 +++++++-----
 test/performance/odp_l2fwd_run |  3 ++-
 2 files changed, 9 insertions(+), 6 deletions(-)
diff mbox

Patch

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..053ca40 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