summaryrefslogtreecommitdiff
path: root/tsp
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-12-13 16:40:56 +0100
committerAleksander Mistewicz <a.mistewicz@samsung.com>2017-02-01 17:36:51 +0100
commited4f85c0245ccbeae3394cf0bf149f80c197ba2d (patch)
treed9cd28e66bf23b6f351af5e9db929835c9c88976 /tsp
parent8b9256dd3fa317293103bcb14c49c8ec77b27bed (diff)
downloadmajor-ed4f85c0245ccbeae3394cf0bf149f80c197ba2d.tar.gz
major-ed4f85c0245ccbeae3394cf0bf149f80c197ba2d.tar.bz2
major-ed4f85c0245ccbeae3394cf0bf149f80c197ba2d.zip
Move update_www to separate job
Change-Id: I330a5784e78dba3eb44b49e2707a70d8f004ef78 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tsp')
-rwxr-xr-xtsp/common.sh11
-rwxr-xr-xtsp/jobs/publish.sh26
-rwxr-xr-xtsp/jobs/update_db.sh1
-rwxr-xr-xtsp/jobs/update_www.sh49
4 files changed, 62 insertions, 25 deletions
diff --git a/tsp/common.sh b/tsp/common.sh
index a6ddcdd..94f12cc 100755
--- a/tsp/common.sh
+++ b/tsp/common.sh
@@ -42,6 +42,7 @@ DBNAME="results.db3"
DBPATH="${WS_PUBLISH}/${DBNAME}"
WWW_PUBLISH="${WS_PUBLISH}/current_status.html"
WWW_3_PUBLISH="${WS_PUBLISH}/current_status_3.html"
+UPDATE_WWW="/var/tmp/should_update_www"
TMP_POLL="/tmp/tl-master-poll"
TMP_MASTER="/tmp/tl-master"
@@ -55,6 +56,16 @@ alias tspoll="TMPDIR=$TMP_POLL TS_SLOTS=1 tsp"
alias tsmaster="TMPDIR=$TMP_MASTER TS_SLOTS=100 tsp"
alias tspwb="TMPDIR=$TMP_PWB TS_SLOTS=1 tsp"
+init_db() {
+ # Load schema
+ sqlite3 -batch "${DBPATH}" < "${TSP_DIR}/results-schema.sql"
+ # Load initial values to tables 'device' and 'result'
+ sqlite3 -batch "${DBPATH}" < "${TSP_DIR}/results-values-device.sql"
+ sqlite3 -batch "${DBPATH}" < "${TSP_DIR}/results-values-result.sql"
+}
+
+test -f "${DBPATH}" || init_db
+
tsrun_target() {
test -n "$1" || die "Missing argument: target"
TMPDIR="/tmp/tl-runner-$1"
diff --git a/tsp/jobs/publish.sh b/tsp/jobs/publish.sh
index ea9b1a0..2df6631 100755
--- a/tsp/jobs/publish.sh
+++ b/tsp/jobs/publish.sh
@@ -144,16 +144,6 @@ echo "$TAG" > "$TAG_FILE"
test -n "$AVOCADO_TAG" || AVOCADO_TAG="$TAG"
-init_db() {
- # Load schema
- sqlite3 -batch "${DBPATH}" < "${TSP_DIR}/results-schema.sql"
- # Load initial values to tables 'device' and 'result'
- sqlite3 -batch "${DBPATH}" < "${TSP_DIR}/results-values-device.sql"
- sqlite3 -batch "${DBPATH}" < "${TSP_DIR}/results-values-result.sql"
-}
-
-test -f "${DBPATH}" || init_db
-
echo "SR: $SR"
echo "TAG: $TAG"
echo "AVOCADO_TAG: $AVOCADO_TAG"
@@ -163,18 +153,4 @@ echo "PROFILE: $PROFILE"
# Publish to database
update_db "$SR" "$AVOCADO_TAG" "$BUILD_NR" "$TARGET"
-# Publish to www
-{
- cat "${TSP_DIR}/html_head"
- "${TSP_DIR}/scripts/publish.py" "${DBPATH}"
- cat "${TSP_DIR}/html_tail"
-} > "${WWW_PUBLISH}"
-
-# Publish to www_3
-{
- cat "${TSP_DIR}/html_head"
- lockfile-create --use-pid "${DBPATH}"
- "${TSP_DIR}/scripts/publish.py" --tizen3 "${DBPATH}"
- lockfile-remove "${DBPATH}"
- cat "${TSP_DIR}/html_tail"
-} > "${WWW_3_PUBLISH}"
+tspwb -L WWW sh "${TSP_DIR}/jobs/update_www.sh"
diff --git a/tsp/jobs/update_db.sh b/tsp/jobs/update_db.sh
index 1c322ee..a87e834 100755
--- a/tsp/jobs/update_db.sh
+++ b/tsp/jobs/update_db.sh
@@ -34,4 +34,5 @@ lockfile-create --use-pid "${DBPATH}"
sqlite3 "${DBPATH}" "insert into test values (NULL,'$SR', CURRENT_TIMESTAMP, $BUILD_NR,\
(select r.rid from result r where r.rname='$TAG'),\
(select d.did from device d where d.dname='$TARGET'));"
+echo "$SR;$TAG;$BUILD_NR;$TARGET" >> "${UPDATE_WWW}"
lockfile-remove "${DBPATH}"
diff --git a/tsp/jobs/update_www.sh b/tsp/jobs/update_www.sh
new file mode 100755
index 0000000..41676e1
--- /dev/null
+++ b/tsp/jobs/update_www.sh
@@ -0,0 +1,49 @@
+#!/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"
+
+# {{{ DBPATH
+lockfile-create --use-pid "${DBPATH}"
+
+test -f "${UPDATE_WWW}" || {
+ # }}} DBPATH
+ lockfile-remove "${DBPATH}"
+ die "No need to update the webpage"
+}
+
+# Publish to www
+{
+ cat "${TSP_DIR}/html_head"
+ "${TSP_DIR}/scripts/publish.py" "${DBPATH}"
+ cat "${TSP_DIR}/html_tail"
+} > "${WWW_PUBLISH}"
+
+# Publish to www_3
+{
+ cat "${TSP_DIR}/html_head"
+ "${TSP_DIR}/scripts/publish.py" --tizen3 "${DBPATH}"
+ cat "${TSP_DIR}/html_tail"
+} > "${WWW_3_PUBLISH}"
+
+rm "${UPDATE_WWW}"
+
+# }}} DBPATH
+lockfile-remove "${DBPATH}"