Add destination argument to ssh_copy and sdb_copy 62/89462/5
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Thu, 22 Sep 2016 09:18:02 +0000 (11:18 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Tue, 3 Jan 2017 15:13:57 +0000 (16:13 +0100)
It is optional and defaults to "/tmp/smoke.sh".

Change-Id: I74db36b9f0066925854fae3d0b4d9079bcfb2f6b
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
tct/conf/conf.sh

index 7ff317e..9f38ecb 100755 (executable)
 
 # Syntax is:
 #   conf_device $ID $NATIVE_TCT_REPO
-#   copy_ssh $IP $FILE
-#   copy_sdb $ID $FILE
+#   copy_ssh $IP $FILE [$DEST]
+#   copy_sdb $ID $FILE [$DEST]
 #
 # 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.
 #
 # Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
 
+DEFAULT_DEST="/tmp/smoke.sh"
+
 conf_device() {
     ID="$1"
     NATIVE_TCT_REPO="$2"
@@ -58,11 +60,13 @@ conf_device() {
 copy_ssh() {
     IP="$1"
     FILE="$2"
+    DEST="$3"
     test -n "${IP}" || die "Missing argument: ip"
     test -n "${FILE}" || die "Missing argument: file"
+    test -n "${DEST}" || DEST="${DEFAULT_DEST}"
     COUNT=1
     while ! timeout 60 sshpass -p 'tizen' scp -F "${TESTLAB_SCRIPTS}/conf/ssh_config" \
-        "${FILE}" "root@${IP}:/tmp/smoke.sh"
+        "${FILE}" "root@${IP}:${DEST}"
     do
         echo "SSH connection to ${IP} failed: retrying" >&2
         if [ ${COUNT} -ge 6 ]
@@ -76,7 +80,9 @@ copy_ssh() {
 copy_sdb() {
     ID="$1"
     FILE="$2"
+    DEST="$3"
     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!"
+    test -n "${DEST}" || DEST="${DEFAULT_DEST}"
+    sdb -s "${ID}" push "${FILE}" "${DEST}" || die "SDB copy failed!"
 }