summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtct/conf/conf.sh32
-rwxr-xr-xtct/minnow_prepare_flash_conf.sh16
-rwxr-xr-xtct/odroid_prepare_flash_conf.sh7
-rwxr-xr-xtct/run/run.sh24
-rwxr-xr-xtct/run/smoke_tests.sh19
5 files changed, 84 insertions, 14 deletions
diff --git a/tct/conf/conf.sh b/tct/conf/conf.sh
index 0a3d8ac..0435a34 100755
--- a/tct/conf/conf.sh
+++ b/tct/conf/conf.sh
@@ -12,7 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Syntax is: conf_device $ID $NATIVE_TCT_REPO
+# Syntax is:
+# conf_device $ID $NATIVE_TCT_REPO
+# copy_ssh $IP $FILE
+# copy_sdb $ID $FILE
+#
# conf_device runs install script from Native TCT repository and copies files
# required by TCT in order to properly test the image on a target device.
#
@@ -50,3 +54,29 @@ conf_device() {
sdb -s "${ID}" push "${TESTLAB_SCRIPTS}/conf/configure_env.sh" /etc/profile.d/
}
+
+copy_ssh() {
+ IP="$1"
+ FILE="$2"
+ test -n "${IP}" || die "Missing argument: ip"
+ test -n "${FILE}" || die "Missing argument: file"
+ COUNT=1
+ while ! sudo sshpass -p 'tizen' scp -F ${TESTLAB_SCRIPTS}/conf/ssh_config \
+ "${FILE}" "root@${IP}:/tmp/smoke.sh"
+ do
+ echo "SSH connection to ${IP} failed: retrying" >&2
+ if [ ${COUNT} -ge 6 ]
+ then
+ die "Timeout: ssh connection failed!"
+ fi
+ COUNT=$((COUNT+1))
+ done
+}
+
+copy_sdb() {
+ ID="$1"
+ FILE="$2"
+ test -n "${ID}" || die "Missing argument: id"
+ test -n "${FILE}" || die "Missing argument: file"
+ sdb -s "${ID}" push "${FILE}" "/tmp/smoke.sh" || die "SDB copy failed!"
+}
diff --git a/tct/minnow_prepare_flash_conf.sh b/tct/minnow_prepare_flash_conf.sh
index dc64574..c493dc1 100755
--- a/tct/minnow_prepare_flash_conf.sh
+++ b/tct/minnow_prepare_flash_conf.sh
@@ -27,6 +27,8 @@ export TESTLAB_SCRIPTS="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)"
. "${TESTLAB_SCRIPTS}/common.sh"
. "${TESTLAB_SCRIPTS}/flash/flash.sh"
+. "${TESTLAB_SCRIPTS}/conf/conf.sh"
+. "${TESTLAB_SCRIPTS}/run/run.sh"
SDMUX="$1"
IMAGE="$2"
@@ -98,15 +100,7 @@ sleep 4
SLEEP=10
-while ! sudo sshpass -p 'tizen' ssh -F ${TESTLAB_SCRIPTS}/conf/ssh_config root@${IP} \
- "systemctl --state=failed | sed -r \"s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m]//g\"" \
- 2>&1 > sysctl.result
-do
- echo "ssh failed, retrying"
- if [ ${SLEEP} -ge 120 ]
- then
- die "Timeout: ssh connection failed!"
- fi
- SLEEP=$((SLEEP+10))
-done
+copy_ssh "${IP}" "${TESTLAB_SCRIPTS}/run/smoke_tests.sh"
+run_smoke_ssh "${IP}"
+
cat sysctl.result
diff --git a/tct/odroid_prepare_flash_conf.sh b/tct/odroid_prepare_flash_conf.sh
index 102b85f..1bb35f4 100755
--- a/tct/odroid_prepare_flash_conf.sh
+++ b/tct/odroid_prepare_flash_conf.sh
@@ -37,6 +37,7 @@ test -n "${IMAGE}" || die "Missing argument: image!"
. "${TESTLAB_SCRIPTS}/prepare/prepare.sh"
. "${TESTLAB_SCRIPTS}/flash/flash.sh"
. "${TESTLAB_SCRIPTS}/conf/conf.sh"
+. "${TESTLAB_SCRIPTS}/run/run.sh"
echo "### prepare ###"
@@ -97,8 +98,10 @@ else
sdb -s "${SDMUX}" root on
fi
-sdb -s "${SDMUX}" shell systemctl --state=failed \
- | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m]//g" 2>&1 | tee sysctl.result
+copy_sdb "${SDMUX}" "${TESTLAB_SCRIPTS}/run/smoke_tests.sh"
+run_smoke_sdb "${SDMUX}"
+
+cat sysctl.result
echo "### cleanup ###"
diff --git a/tct/run/run.sh b/tct/run/run.sh
index bbaa6e3..bfb670d 100755
--- a/tct/run/run.sh
+++ b/tct/run/run.sh
@@ -18,6 +18,8 @@
# * create_chroot $ID
# * delete_chroot $ID
# * run_in_chroot $ID $CMD
+# * run_smoke_ssh $IP
+# * run_smoke_sdb $ID
#
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
@@ -74,3 +76,25 @@ run_in_chroot() {
sudo chroot --userspec=tct "/mnt/${ID}" $CMD
}
+
+run_smoke_ssh() {
+ IP="$1"
+ test -n "${IP}" || die "Missing argument: ip"
+ COUNT=1
+ while ! sudo sshpass -p 'tizen' ssh -F ${TESTLAB_SCRIPTS}/conf/ssh_config \
+ "root@${IP}" sh "/tmp/smoke.sh" > sysctl.result
+ do
+ echo "SSH connection to ${IP} failed: retrying" >&2
+ if [ ${COUNT} -ge 6 ]
+ then
+ die "Timeout: ssh connection failed!"
+ fi
+ COUNT=$((COUNT+1))
+ done
+}
+
+run_smoke_sdb() {
+ ID="$1"
+ test -n "${ID}" || die "Missing argument: id"
+ sdb -s "${ID}" shell sh "/tmp/smoke.sh" > sysctl.result
+}
diff --git a/tct/run/smoke_tests.sh b/tct/run/smoke_tests.sh
new file mode 100755
index 0000000..391d5df
--- /dev/null
+++ b/tct/run/smoke_tests.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
+
+systemctl --state=failed | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m]//g" 2>&1