On Thu, Mar 30, 2017 at 11:20 AM, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> bash -lt syntax expects 2 integer values, not strings.
> Also return code of piped command needs to be get in
> a little bit different way.
> https://bugs.linaro.org/show_bug.cgi?id=2872
>
> Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>

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

> ---
>  v2: after repairing test logic make distcheck failed due to
>      missing targets. Added what was needed.
>
>  test/common_plat/performance/Makefile.am           |  2 ++
>  .../performance/odp_pktio_ordered_run.sh           | 36 
> ++++++++++++++++------
>  2 files changed, 28 insertions(+), 10 deletions(-)
>
> diff --git a/test/common_plat/performance/Makefile.am 
> b/test/common_plat/performance/Makefile.am
> index 9111c0c2..3299f03f 100644
> --- a/test/common_plat/performance/Makefile.am
> +++ b/test/common_plat/performance/Makefile.am
> @@ -51,3 +51,5 @@ dist_odp_scheduling_SOURCES = odp_scheduling.c
>  dist_odp_pktio_perf_SOURCES = odp_pktio_perf.c
>
>  EXTRA_DIST = $(TESTSCRIPTS)
> +
> +dist_check_SCRIPTS = udp64.pcap
> diff --git a/test/common_plat/performance/odp_pktio_ordered_run.sh 
> b/test/common_plat/performance/odp_pktio_ordered_run.sh
> index d91211c0..d6c2be52 100755
> --- a/test/common_plat/performance/odp_pktio_ordered_run.sh
> +++ b/test/common_plat/performance/odp_pktio_ordered_run.sh
> @@ -5,14 +5,21 @@
>  #
>  # SPDX-License-Identifier:     BSD-3-Clause
>  #
> +TEST_SRC_DIR=$(dirname $0)
> +TEST_DIR="${TEST_DIR:-$(dirname $0)}"
>
>  DURATION=5
>  LOG=odp_pktio_ordered.log
>  LOOPS=100000000
>  PASS_PPS=5000
> -PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit`
> +PCAP_IN=`find . ${TEST_SRC_DIR} $(dirname $0) -name udp64.pcap -print -quit`
>  PCAP_OUT=/dev/null
>
> +if [ ! -f ${PCAP_IN} ]; then
> +       echo "FAIL: no udp64.pcap"
> +       exit 1
> +fi
> +
>  # This just turns off output buffering so that you still get periodic
>  # output while piping to tee, as long as stdbuf is available.
>  if [ "$(which stdbuf)" != "" ]; then
> @@ -21,20 +28,29 @@ else
>         STDBUF=
>  fi
>
> -$STDBUF ./odp_pktio_ordered${EXEEXT} -i pcap:in=${PCAP_IN}:loops=$LOOPS,\
> -pcap:out=${PCAP_OUT} -t $DURATION | tee $LOG
> +$STDBUF ${TEST_DIR}/odp_pktio_ordered${EXEEXT} \
> +       -i pcap:in=${PCAP_IN}:loops=$LOOPS,pcap:out=${PCAP_OUT} \
> +       -t $DURATION | tee $LOG
>
> -ret=$?
> +ret=${PIPESTATUS[0]}
> +
> +if [ $ret -ne 0 ]; then
> +       echo "FAIL: no odp_pktio_ordered${EXEEXT}"
> +       rm -f $LOG
> +       exit $ret
> +fi
>
>  if [ ! -f $LOG ]; then
>         echo "FAIL: $LOG not found"
>         ret=1
> -elif [ $ret -eq 0 ]; then
> -       MAX_PPS=$(awk '/TEST RESULT/ {print $3}' $LOG)
> -       if [ "$MAX_PPS" -lt "$PASS_PPS" ]; then
> -               echo "FAIL: pps below threshold $MAX_PPS < $PASS_PPS"
> -               ret=1
> -       fi
> +       exit $ret
> +fi
> +
> +MAX_PPS=$(awk '/TEST RESULT/ {print $3}' $LOG)
> +echo "MAX_PPS=$MAX_PPS"
> +if [ $MAX_PPS -lt $PASS_PPS ]; then
> +       echo "FAIL: pps below threshold $MAX_PPS < $PASS_PPS"
> +       ret=1
>  fi
>
>  rm -f $LOG
> --
> 2.11.0.295.gd7dffce
>

Reply via email to