test: perf: fix bash syntax in odp_pktio_ordered_run.sh

Message ID 20170321165058.31753-1-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov March 21, 2017, 4:50 p.m.
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.uvarov@linaro.org>

---
 .../performance/odp_pktio_ordered_run.sh           | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

-- 
2.11.0.295.gd7dffce

Comments

Maxim Uvarov March 28, 2017, 2:57 p.m. | #1
ping

On 03/21/17 19:50, Maxim Uvarov 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.uvarov@linaro.org>

> ---

>  .../performance/odp_pktio_ordered_run.sh           | 22 +++++++++++++++-------

>  1 file changed, 15 insertions(+), 7 deletions(-)

> 

> diff --git a/test/common_plat/performance/odp_pktio_ordered_run.sh b/test/common_plat/performance/odp_pktio_ordered_run.sh

> index d91211c0..8b20cd59 100755

> --- a/test/common_plat/performance/odp_pktio_ordered_run.sh

> +++ b/test/common_plat/performance/odp_pktio_ordered_run.sh

> @@ -24,17 +24,25 @@ fi

>  $STDBUF ./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

>
Bill Fischofer March 29, 2017, 3:14 a.m. | #2
On Tue, Mar 21, 2017 at 11:50 AM, Maxim Uvarov <maxim.uvarov@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.uvarov@linaro.org>

>


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



> ---

>  .../performance/odp_pktio_ordered_run.sh           | 22

> +++++++++++++++-------

>  1 file changed, 15 insertions(+), 7 deletions(-)

>

> diff --git a/test/common_plat/performance/odp_pktio_ordered_run.sh

> b/test/common_plat/performance/odp_pktio_ordered_run.sh

> index d91211c0..8b20cd59 100755

> --- a/test/common_plat/performance/odp_pktio_ordered_run.sh

> +++ b/test/common_plat/performance/odp_pktio_ordered_run.sh

> @@ -24,17 +24,25 @@ fi

>  $STDBUF ./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

>

>
Maxim Uvarov March 29, 2017, 4:08 p.m. | #3
in Travis this fails but passes locally. Will look more on reasons
before merge it. Looks like after it began to work MAX_PPS rate should
be adjusted to some number.

Maxim.

On 03/29/17 06:14, Bill Fischofer wrote:
> 

> 

> On Tue, Mar 21, 2017 at 11:50 AM, Maxim Uvarov <maxim.uvarov@linaro.org

> <mailto:maxim.uvarov@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

>     <https://bugs.linaro.org/show_bug.cgi?id=2872>

> 

>     Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org

>     <mailto:maxim.uvarov@linaro.org>>

> 

> 

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

> <mailto:bill.fischofer@linaro.org>>

>  

> 

>     ---

>      .../performance/odp_pktio_ordered_run.sh           | 22

>     +++++++++++++++-------

>      1 file changed, 15 insertions(+), 7 deletions(-)

> 

>     diff --git a/test/common_plat/performance/odp_pktio_ordered_run.sh

>     b/test/common_plat/performance/odp_pktio_ordered_run.sh

>     index d91211c0..8b20cd59 100755

>     --- a/test/common_plat/performance/odp_pktio_ordered_run.sh

>     +++ b/test/common_plat/performance/odp_pktio_ordered_run.sh

>     @@ -24,17 +24,25 @@ fi

>      $STDBUF ./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

> 

>

Patch

diff --git a/test/common_plat/performance/odp_pktio_ordered_run.sh b/test/common_plat/performance/odp_pktio_ordered_run.sh
index d91211c0..8b20cd59 100755
--- a/test/common_plat/performance/odp_pktio_ordered_run.sh
+++ b/test/common_plat/performance/odp_pktio_ordered_run.sh
@@ -24,17 +24,25 @@  fi
 $STDBUF ./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