From 2ac45d9ead27ad2934c3bfb74ca6b4ee39d53389 Mon Sep 17 00:00:00 2001 From: Yongqin Liu Date: Mon, 16 May 2016 10:20:32 +0800 Subject: android multinode-target.yaml: add check for ip before send ip to host Since there are adbd restart instructions there, and this will cause the dhcpd_eth0 restarted, so we need to wait for the IP available via ping before run the lava-send command Change-Id: I1e5ac7b2fba3b84aa2b8c317438a1fa35d0365b2 Signed-off-by: Yongqin Liu --- android/multinode-target.yaml | 3 +++ android/scripts/wait_via_ping.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 android/scripts/wait_via_ping.sh diff --git a/android/multinode-target.yaml b/android/multinode-target.yaml index 9d49164..8119a08 100644 --- a/android/multinode-target.yaml +++ b/android/multinode-target.yaml @@ -25,6 +25,8 @@ params: # identification to the host side. Default is ETH # which means adb-over-ethernet is used ADB_LINK: "ETH" + # timeout value to wait until the ip ia available for ping LAVA_SERVER_IP + PING_TIMEOUT: 10 run: steps: @@ -45,6 +47,7 @@ run: - lava-test-case step6-disable-kmsg --shell echo '1 1 1 1' > /proc/sys/kernel/printk - lava-test-case step7-stop-adbd --shell stop adbd - lava-test-case step8-start-adbd --shell start adbd + - ./android/scripts/wait_via_ping.sh ${LAVA_SERVER_IP} ${PING_TIMEOUT} - fi - if [ -z $SERIALNO ] && [ -z $IPADDR ] - then diff --git a/android/scripts/wait_via_ping.sh b/android/scripts/wait_via_ping.sh new file mode 100755 index 0000000..8c373e5 --- /dev/null +++ b/android/scripts/wait_via_ping.sh @@ -0,0 +1,28 @@ +#!/system/bin/sh + +lava_server_ip=$1 +timeout_val=$2 + +if [ -z "${lava_server_ip}" ]; then + return +fi +if [ -z "${timeout_val}" ]; then + timeout_val=10 +fi + +echo "Timeout value is ${timeout_val}" +sleep 5 +ping_count=0 +echo "ping start: $(date)" +while ! LC_ALL=C ping -W1 -c1 ${lava_server_ip} ; do + sleep 1 + ping_count=$((ping_count + 1)) + if [ $ping_count -ge ${timeout_val} ]; then + exit 1 + fi +done +# see how long it will take for the ip to available +echo "ping finished: $(date)" +ifconfig + +exit 0 -- cgit v1.2.3