summaryrefslogtreecommitdiff
path: root/tsp/jobs
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-07-29 11:21:02 +0200
committerAleksander Mistewicz <a.mistewicz@samsung.com>2016-12-06 16:37:14 +0100
commit020f200b1bdd7f12e0eb8861d7b105bd67c35f51 (patch)
treee5e7284dcb52dc6e695e79b4b60defcad6d12540 /tsp/jobs
parent701a3e68224e4556c237174c4386005d67d14101 (diff)
downloadmajor-020f200b1bdd7f12e0eb8861d7b105bd67c35f51.tar.gz
major-020f200b1bdd7f12e0eb8861d7b105bd67c35f51.tar.bz2
major-020f200b1bdd7f12e0eb8861d7b105bd67c35f51.zip
Fix build_nr in tsp/jobs/trigger_downloads.sh
If a url is present in tsmaster queue $i value will be changed to last killed task's number or simply undefined value. Rename $i to $next Add update_next() which checks if write to a file was successful. Append to unique_dispatch instead of overwrite. Change-Id: Ib49c248a0f756a090c2408a7ae60be76dccd707a Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tsp/jobs')
-rwxr-xr-xtsp/jobs/trigger_downloads.sh23
1 files changed, 13 insertions, 10 deletions
diff --git a/tsp/jobs/trigger_downloads.sh b/tsp/jobs/trigger_downloads.sh
index 6dfa605..e434245 100755
--- a/tsp/jobs/trigger_downloads.sh
+++ b/tsp/jobs/trigger_downloads.sh
@@ -23,13 +23,16 @@ export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
mkdir -p "${WS_WATCHER}"
cd "${WS_WATCHER}"
touch next_dwn
-i=$(cat next_dwn)
-test -n "$i" || i=1
+next=$(cat next_dwn)
+test -n "$next" || next=1
+# Allocate 300 numbers in case this script terminates during dispatch
+echo $((next+300)) > "${WS_WATCHER}/next_dwn" || die "Write failed: ${WS_WATCHER}/next_dwn"
+# Append to unique_dispatch in case previous job failed
if [ -f manual_urls ];
then
- sort -u modified_urls manual_urls > unique_dispatch
+ sort -u modified_urls manual_urls >> unique_dispatch
else
- cp modified_urls unique_dispatch
+ cat modified_urls >> unique_dispatch
fi
while read -r url
do
@@ -44,16 +47,16 @@ do
for i in $(tsmaster | awk -v URL="$url" '$2 ~ "running" && $0 ~ URL {print $1}'); do kill "$(tsmaster -p "$i")"; done
for target in "minnow32" "minnow64" "odroid"
do
- rm -rf "${WS_DOWNLOAD}/$i"
- mkdir -p "${WS_DOWNLOAD}/$i"
- cd "${WS_DOWNLOAD}/$i"
+ rm -rf "${WS_DOWNLOAD}/$next"
+ mkdir -p "${WS_DOWNLOAD}/$next"
+ cd "${WS_DOWNLOAD}/$next"
# Download image for $target
nr=$(tsmaster -L "DOWNLOAD_IMAGE_${target}" python "${TSP_DIR}/scripts/download_image.py" --log=INFO -t "${target}" "$url")
nr=$(tsmaster -D "$nr" -L "IMAGE_TEST" \
- sh "${TSP_DIR}/jobs/img_test_common.sh" "$i" "$target")
- i=$((i+1))
+ sh "${TSP_DIR}/jobs/img_test_common.sh" "$next" "$target")
+ next=$((next+1))
done
done < unique_dispatch
cd "${WS_WATCHER}"
-echo "$i" > "next_dwn"
+echo "$next" > "${WS_WATCHER}/next_dwn" || die "Write failed: ${WS_WATCHER}/next_dwn"
rm -f unique_dispatch modified_urls manual_urls