summaryrefslogtreecommitdiff
path: root/tct
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-10-18 16:15:47 +0200
committerAleksander Mistewicz <a.mistewicz@samsung.com>2017-01-10 10:49:05 +0100
commitcfc8efcbdad178998f6168f0ec2524df2b28cd7f (patch)
treed578fd225b9dbbbbdc9df825ae55dbf070d470cd /tct
parent9d42a7b83449ef1a1e83a86a305388d5c6e33669 (diff)
downloadmajor-cfc8efcbdad178998f6168f0ec2524df2b28cd7f.tar.gz
major-cfc8efcbdad178998f6168f0ec2524df2b28cd7f.tar.bz2
major-cfc8efcbdad178998f6168f0ec2524df2b28cd7f.zip
Move wait_ssh() to tct/conf/conf.sh
Change-Id: I55f0426b19a503ca998e711d350d5c4249381848 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tct')
-rwxr-xr-xtct/conf/conf.sh43
-rwxr-xr-xtct/minnow_prepare_flash_conf.sh37
2 files changed, 44 insertions, 36 deletions
diff --git a/tct/conf/conf.sh b/tct/conf/conf.sh
index b8d8d00..26f0d21 100755
--- a/tct/conf/conf.sh
+++ b/tct/conf/conf.sh
@@ -77,6 +77,49 @@ copy_ssh() {
done
}
+wait_ssh() {
+ SDMUX="$1"
+ test -n "${SDMUX}" || die "Missing argument: sdmux"
+
+ CONNECT_CNT=0
+ SLEEP=${INIT_SLEEP}
+
+ sleep "${SLEEP}"
+
+ while ! ping -c 1 "${IP}" -W 1 | grep -q icmp_seq
+ do
+ printf ","
+ if [ ${SLEEP} -ge ${MAX_SLEEP} ]
+ then
+ die "Timeout: host not found in the network!"
+ fi
+ if [ ${SLEEP} -ge ${RESTART_SLEEP} ]
+ then
+ echo "Restarting ${SDMUX}" >&2
+ restart_device "${SDMUX}"
+ fi
+ sleep "${SLEEP}"
+ SLEEP=$((SLEEP+INC_SLEEP))
+ CONNECT_CNT=$((CONNECT_CNT+1))
+ done
+
+ printf "\n" >&2
+
+ SLEEP=10
+
+ while ! nc -q 1 "${IP}" 22 </dev/null
+ do
+ printf "."
+ if [ ${SLEEP} -ge ${MAX_SLEEP} ]
+ then
+ die "Timeout: ssh port not open!"
+ fi
+ SLEEP=$((SLEEP+INC_SLEEP))
+ CONNECT_CNT=$((CONNECT_CNT+1))
+ done
+ echo "${CONNECT_CNT}"
+}
+
copy_sdb() {
ID="$1"
FILE="$2"
diff --git a/tct/minnow_prepare_flash_conf.sh b/tct/minnow_prepare_flash_conf.sh
index 8f7308d..09a4a42 100755
--- a/tct/minnow_prepare_flash_conf.sh
+++ b/tct/minnow_prepare_flash_conf.sh
@@ -63,42 +63,7 @@ restart_device "${SDMUX}"
echo "### conf ###"
-CONNECT_CNT=0
-SLEEP=${INIT_SLEEP}
-
-sleep "${SLEEP}"
-
-while ! ping -c 1 "${IP}" -W 1 | grep -q icmp_seq
-do
- printf ","
- if [ ${SLEEP} -ge ${MAX_SLEEP} ]
- then
- die "Timeout: host not found in the network!"
- fi
- if [ ${SLEEP} -ge ${RESTART_SLEEP} ]
- then
- echo "Restarting MINNOW" >&2
- restart_device "${SDMUX}"
- fi
- sleep "${SLEEP}"
- SLEEP=$((SLEEP+INC_SLEEP))
- CONNECT_CNT=$((CONNECT_CNT+1))
-done
-
-printf "\n"
-
-SLEEP=10
-
-while ! nc -q 1 "${IP}" 22 </dev/null
-do
- printf "."
- if [ ${SLEEP} -ge 60 ]
- then
- die "Timeout: ssh port not open!"
- fi
- SLEEP=$((SLEEP+10))
- CONNECT_CNT=$((CONNECT_CNT+1))
-done
+CONNECT_CNT="$(wait_ssh "${SDMUX}")"
printf "\n"
echo "CONNECT_CNT $CONNECT_CNT" > sysctl.result