diff mbox

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

Message ID 1440693159-8111-2-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit 35cf8e1ff40e3fad3d2edec4cacd9e6028245cc1
Headers show

Commit Message

Maxim Uvarov Aug. 27, 2015, 4:32 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(-)

Comments

Bill Fischofer Aug. 31, 2015, 1:10 p.m. UTC | #1
On Thu, Aug 27, 2015 at 11:32 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> 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>
>

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>


> ---
>  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
> --
> 1.9.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
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..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