Add tsp/jobs/img_test_common.sh 16/69716/12
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Thu, 5 May 2016 10:00:17 +0000 (12:00 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Thu, 23 Jun 2016 15:05:14 +0000 (17:05 +0200)
Change-Id: Id01f48f4135e5fddf64a2ef873a2cfc2949438fc
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
tsp/common.sh
tsp/jobs/img_test_common.sh [new file with mode: 0755]
tsp/jobs/img_test_minnow.sh [new symlink]
tsp/jobs/img_test_odroid.sh [new symlink]
tsp/jobs/trigger_downloads.sh

index 2c5f883..c4b59c3 100755 (executable)
@@ -30,3 +30,24 @@ die() {
 alias tspoll="TS_SOCKET=/tmp/socket.tl-master-poll tsp"
 alias tsmaster="TS_SOCKET=/tmp/socket.tl-master tsp"
 alias tspwb="TS_SOCKET=/tmp/socket.tl-pwb tsp"
+
+tsrun_target() {
+    test -n "$1" || die "Missing argument: target"
+    SOCK="/tmp/socket.tl-runner-$1"
+    shift
+    TS_SOCKET="$SOCK" tsp $@
+}
+
+check_diff() {
+    DIFF_FILE="$1"
+    JOB_NR="$2"
+    test -n "$1" || die "Missing argument: diff file"
+    test -n "$2" || die "Missing argument: build nr"
+    test -n "${TSP_DIR}" || die "Missing environment variable: TSP_DIR"
+    if grep -q "identical" "${DIFF_FILE}"
+    then
+        echo "Image is unchanged in respect to snapshot"
+        nr=`tspwb -L PUBLISH sh ${TSP_DIR}/jobs/publish.sh ${JOB_NR}`
+        return 1
+    fi
+}
diff --git a/tsp/jobs/img_test_common.sh b/tsp/jobs/img_test_common.sh
new file mode 100755 (executable)
index 0000000..3f347a2
--- /dev/null
@@ -0,0 +1,45 @@
+#!/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>
+
+export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.."
+
+. "${TSP_DIR}/common.sh"
+
+test -n "$1" || die "Missing argument: build nr"
+
+WORKDIR="${HOME}/ws/img_test/$1"
+WORKDIR_REMOTE="${HOME}/ws/img_test_remote/$1"
+DWN_WORKDIR="${HOME}/ws/dwn/$1"
+case "$0" in
+    *odroid*)
+        TARGET="odroid"
+        ;;
+    *minnow*)
+        TARGET="minnow"
+        ;;
+esac
+PROJECT_FILE="${DWN_WORKDIR}/project-${TARGET}.conf"
+DIFF_FILE="${DWN_WORKDIR}/diff-${TARGET}.report"
+mkdir -p "${WORKDIR}"
+cd "${WORKDIR}"
+if $(check_diff "${DIFF_FILE}" "$1");
+then
+    echo "Add ${TARGET}_prep_flash_conf job to the queue"
+    tsrun_target $TARGET -L "$(echo "$TARGET" | tr 'a-z' 'A-Z')_PREPARE_FLASH_CONF" \
+        sh "${TSP_DIR}/jobs/${TARGET}_prep_flash_conf.sh" "$1"
+fi
diff --git a/tsp/jobs/img_test_minnow.sh b/tsp/jobs/img_test_minnow.sh
new file mode 120000 (symlink)
index 0000000..0ceb2d6
--- /dev/null
@@ -0,0 +1 @@
+img_test_common.sh
\ No newline at end of file
diff --git a/tsp/jobs/img_test_odroid.sh b/tsp/jobs/img_test_odroid.sh
new file mode 120000 (symlink)
index 0000000..0ceb2d6
--- /dev/null
@@ -0,0 +1 @@
+img_test_common.sh
\ No newline at end of file
index e4ef4c5..05f91c5 100755 (executable)
@@ -34,6 +34,8 @@ do
         cd "${HOME}/ws/dwn/$i"
         # Download image for $target
         nr=$(tsmaster -L "DOWNLOAD_IMAGE_${target}" python "${TSP_DIR}/scripts/download_image.py" "--${target}" "$url")
+        nr=$(tsmaster -D "$nr" -L "IMAGE_TEST_${target}" \
+            sh ${TSP_DIR}/jobs/img_test_${target}.sh "$i")
         i=$((i+1))
     done
 done