diff options
author | Botao Sun <botao.sun@linaro.org> | 2014-10-17 02:16:31 +1100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-10-20 13:41:11 +0000 |
commit | 501c309c584e6087f1e24974b2863d42fc5e98d8 (patch) | |
tree | 9b25413b1cc1b136c2d80e93da8da13cd3887b32 /android | |
parent | 16f86e4a57015c98f89a7e3c6ad5a08105d1108e (diff) |
ethernet-android.sh: POSIX Compliant Update.
This change is to make the test script to be POSIX compliant.
Original patch comes from:
Lucas Dutra Nunes <ldnunes@ossystems.com.br>
Signed-off by: Botao Sun <botao.sun@linaro.org>
Change-Id: Icaba7ab2a36355dbfc4cc77379c413136e9223fc
Diffstat (limited to 'android')
-rwxr-xr-x | android/scripts/ethernet-android.sh | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/android/scripts/ethernet-android.sh b/android/scripts/ethernet-android.sh index 7c94fcb..276f1da 100755 --- a/android/scripts/ethernet-android.sh +++ b/android/scripts/ethernet-android.sh @@ -2,7 +2,7 @@ # # Ethernet test cases for Linaro Android # -# Copyright (C) 2013, Linaro Limited. +# Copyright (C) 2010 - 2014, Linaro Limited. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,7 +20,7 @@ # # Author: Botao Sun <botao.sun@linaro.org> -function check_return_fail() { +check_return_fail() { if [ $? -ne 0 ]; then fail_test "$1" return 0 @@ -29,12 +29,12 @@ function check_return_fail() { fi } -function fail_test() { +fail_test() { local reason=$1 echo "${TEST}: FAIL - ${reason}" } -function pass_test() { +pass_test() { echo "${TEST}: PASS" } @@ -118,11 +118,10 @@ test_ethernet_ping() { ip_address_line=`busybox ifconfig eth0 | grep "inet addr"` echo $ip_address_line - ip_address_array=($ip_address_line) - ip_address_element=${ip_address_array[1]} + ip_address_element=$(echo $ip_address_line | awk '{print $2}') echo $ip_address_element - ip_address=${ip_address_element:5} + ip_address=$(echo $ip_address_element | awk -F: '{print $2}') echo $ip_address # Ping test here @@ -136,8 +135,7 @@ test_ethernet_ping() { packet_loss_line=`ping -c 5 -I ${ip_address} www.google.com | grep "packet loss"` echo $packet_loss_line - packet_loss_array=($packet_loss_line) - packet_loss=${packet_loss_array[5]} + packet_loss=$(echo $packet_loss_line | awk '{print $6}') echo "The packet loss rate is $packet_loss" if [ "$packet_loss" != "0%" ]; then @@ -152,5 +150,6 @@ test_ethernet_ping() { test_disable_ethernet test_enable_ethernet test_ethernet_ping + # clean exit so lava-test can trust the results -exit 0
\ No newline at end of file +exit 0 |