die() {
printf >&2 -- '%s\n' "$1"
- exit ${2:-1}
+ exit "${2:-1}"
}
test -z "${TSP_DIR}" || export TS_ONFINISH="${TSP_DIR}/scripts/log.sh"
shift
TMPDIR="$TMPDIR" TS_SLOTS=1 tsp $@
}
-
-check_diff() {
- DIFF_FILE="$1"
- JOB_NR="$2"
- TARGET="$3"
- test -n "$1" || die "Missing argument: diff file"
- test -n "$2" || die "Missing argument: build nr"
- test -n "$3" || die "Missing argument: target"
- 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} ${TARGET}`
- return 1
- fi
-}
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
-export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.."
+export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
. "${TSP_DIR}/common.sh"
test -n "${BUILD_NR}" || die "Missing argument: build nr"
test -n "$TARGET" || die "Missing argument: target"
-WORKDIR="${WS_TEST}/${BUILD_NR}"
WORKDIR_REMOTE="${WS_TEST_REMOTE}/${BUILD_NR}"
DWN_WORKDIR="${WS_DOWNLOAD}/${BUILD_NR}"
case "$TARGET" in
*odroid*)
- BOOT_IMG="`ls ${DWN_WORKDIR}/tizen-common_*-boot-*.tar.gz`"
- USERSPACE_IMG="`ls ${DWN_WORKDIR}/tizen-common_*-wayland-*.tar.gz`"
+ BOOT_IMG="$(ls "${DWN_WORKDIR}"/tizen-common_*-boot-*.tar.gz)"
+ USERSPACE_IMG="$(ls "${DWN_WORKDIR}"/tizen-common_*-wayland-*.tar.gz)"
;;
*minnow*)
- USERSPACE_IMG="`ls ${DWN_WORKDIR}/tizen-common_*-wayland-*-sda.raw.bz2`"
- USERSPACE_IMG_BMAP="`ls ${DWN_WORKDIR}/tizen-common_*-wayland-*-sda.bmap`"
+ USERSPACE_IMG="$(ls "${DWN_WORKDIR}"/tizen-common_*-wayland-*-sda.raw.bz2)"
+ USERSPACE_IMG_BMAP="$(ls "${DWN_WORKDIR}"/tizen-common_*-wayland-*-sda.bmap)"
;;
esac
# Add job back to the queue
echo "Retrigger... ($1)"
echo "FAILED 1" > sysctl.result
- tsrun_target "${TARGET}" -L "RETRIGGERED_$(echo "$TARGET" | tr 'a-z' 'A-Z')_PREPARE_FLASH_CONF" \
- sh "${TSP_DIR}/jobs/common_prep_flash_conf.sh" "$BUILD_NR" "${TARGET}" "$(($FAIL_CNT + 1))"
+ tsrun_target "${TARGET}" -L "RETRIGGERED_$(echo "$TARGET" | tr '[:lower:]' '[:upper:]')_PREPARE_FLASH_CONF" \
+ sh "${TSP_DIR}/jobs/common_prep_flash_conf.sh" "$BUILD_NR" "${TARGET}" "$((FAIL_CNT + 1))"
exit 0
}
if [ "$FAIL_CNT" -ge 2 ]; then
# Trigger publish job
- tspwb -L PUBLISH sh ${TSP_DIR}/jobs/publish.sh "$BUILD_NR" "$TARGET"
+ tspwb -L PUBLISH sh "${TSP_DIR}/jobs/publish.sh" "$BUILD_NR" "$TARGET"
exit 1
fi
# Copy the results
scp tl-runner:"${WORKDIR_REMOTE}/sysctl.result" .
-echo "RETRIGGER_CNT ${FAIL_CNT}" >> sysctl.result
-echo "Build nr: $BUILD_NR" >> sysctl.result
-echo "Date: `date`" >> sysctl.result
+{
+ echo "RETRIGGER_CNT ${FAIL_CNT}"
+ echo "Build nr: ${BUILD_NR}"
+ echo "Date: $(date)"
+} >> sysctl.result
# Check if they have run successfully, otherwise reschedule the job
if grep -q "Testing failed." sysctl.result
fi
# Trigger publish job
-tspwb -L PUBLISH sh ${TSP_DIR}/jobs/publish.sh "$BUILD_NR" "$TARGET"
+tspwb -L PUBLISH sh "${TSP_DIR}/jobs/publish.sh" "$BUILD_NR" "$TARGET"
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
-export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.."
+export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
. "${TSP_DIR}/common.sh"
test -n "$1" || die "Missing argument: build nr"
WORKDIR="${WS_TEST}/$1"
-WORKDIR_REMOTE="${WS_TEST_REMOTE}/$1"
DWN_WORKDIR="${WS_DOWNLOAD}/$1"
-
TARGET="$2"
+check_diff() {
+ DIFF_FILE="$1"
+ JOB_NR="$2"
+ TARGET="$3"
+ test -n "$1" || die "Missing argument: diff file"
+ test -n "$2" || die "Missing argument: build nr"
+ test -n "$3" || die "Missing argument: target"
+ 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"
+ tspwb -L PUBLISH sh "${TSP_DIR}/jobs/publish.sh" "${JOB_NR}" "${TARGET}"
+ return 1
+ fi
+}
+
test -n "$TARGET" || die "Missing argument: target"
case "$TARGET" in
*minnow*)
- PROJECT_FILE="${DWN_WORKDIR}/project-minnow.conf"
DIFF_FILE="${DWN_WORKDIR}/diff-minnow.report"
;;
*)
- PROJECT_FILE="${DWN_WORKDIR}/project-${TARGET}.conf"
DIFF_FILE="${DWN_WORKDIR}/diff-${TARGET}.report"
;;
esac
rm -rf "${WORKDIR}"
mkdir -p "${WORKDIR}"
cd "${WORKDIR}"
-if $(check_diff "${DIFF_FILE}" "$1" "${TARGET}");
+if check_diff "${DIFF_FILE}" "$1" "${TARGET}";
then
echo "Add common_prep_flash_conf job to the $TARGET queue"
- tsrun_target $TARGET -L "$(echo "$TARGET" | tr 'a-z' 'A-Z')_PREPARE_FLASH_CONF" \
+ tsrun_target "$TARGET" -L "$(echo "$TARGET" | tr '[:lower:]' '[:upper:]')_PREPARE_FLASH_CONF" \
sh "${TSP_DIR}/jobs/common_prep_flash_conf.sh" "$1" "${TARGET}"
fi
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
-export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.."
+export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
. "${TSP_DIR}/common.sh"
test -n "$KEY" || die "Missing argument: key"
test -n "$DICT" || die "Missing argument: dict"
- VALUE="`awk -v KEY="${KEY}" '$1 == KEY {print $2}' $DICT`"
+ VALUE="$(awk -v KEY="${KEY}" '$1 == KEY {print $2}' "$DICT")"
echo "$VALUE"
}
"JOURNAL_TOTAL_CNT" "JOURNAL_DIFF_CNT" "SERVICES_FAIL_CNT"
do
# FILE is read every time because sh does not preserve file endings (zsh does)
- eval "${PREFIX}${key}"=`get_value_of_key_from_dict $key $FILE`
+ eval "${PREFIX}${key}"=$(get_value_of_key_from_dict "$key" "$FILE")
done
}
echo "OK"
}
-PROJECT_FILE="`ls ${DWN_WORKDIR}/project-*.conf`"
-DIFF_FILE="`ls ${DWN_WORKDIR}/diff-*.report`"
+PROJECT_FILE="$(ls "${DWN_WORKDIR}/project-*.conf")"
+DIFF_FILE="$(ls "${DWN_WORKDIR}/diff-*.report")"
SYSCTL_FILE="${IMG_WORKDIR}/sysctl.result"
SNAPSHOT_SYSCTL_FILE="${WS_TEST}/snapshot_sysctl_${TARGET}"
TAG_FILE="${IMG_WORKDIR}/tag"
test -f "${DBPATH}" || init_db
-SR="`head -n 1 ${PROJECT_FILE}`"
+SR=$(head -n 1 "${PROJECT_FILE}")
echo "SR: $SR"
echo "TAG: $TAG"
(select d.did from device d where d.dname='$TARGET'));"
# Publish to www
-cat "${TSP_DIR}/html_head" > "${WWW_PUBLISH}"
-${TSP_DIR}/scripts/publish.py "${DBPATH}" >> "${WWW_PUBLISH}"
-cat "${TSP_DIR}/html_tail" >> "${WWW_PUBLISH}"
+{
+ cat "${TSP_DIR}/html_head"
+ "${TSP_DIR}/scripts/publish.py" "${DBPATH}"
+ cat "${TSP_DIR}/html_tail"
+} > "${WWW_PUBLISH}"
# Clean up workspace
ssh tl-pwb "rm -rf \"${WORKSPACE}\"; mkdir -p \"${WORKSPACE}\"" || echo "rm failed"
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
-export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.."
+export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
. "${TSP_DIR}/common.sh"
touch next_dwn
i=$(cat next_dwn)
test -n "$i" || i=1
-for url in $(cat modified_urls manual_urls | sort -u)
+if [ -f manual_urls ];
+then
+ sort -u modified_urls manual_urls > unique_dispatch
+else
+ cp modified_urls unique_dispatch
+fi
+while read -r url
do
+ test -n "${url}" || continue
echo "Processing: ${url}"
- if [ $url = "*latest*" ]
+ if [ "$url" = "*latest*" ]
then
echo "Skipping symlink url"
continue
fi
# kill currently running jobs for this url
- for i in $(tsmaster | awk -v URL="$url" '$2 ~ "running" && $0 ~ URL {print $1}'); do kill `tsmaster -p $i`; done
+ 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"
# Download image for $target
nr=$(tsmaster -L "DOWNLOAD_IMAGE_${target}" python "${TSP_DIR}/scripts/download_image.py" --log=INFO "--${target}" "$url")
nr=$(tsmaster -D "$nr" -L "IMAGE_TEST" \
- sh ${TSP_DIR}/jobs/img_test_common.sh "$i" "$target")
+ sh "${TSP_DIR}/jobs/img_test_common.sh" "$i" "$target")
i=$((i+1))
done
-done
+done < unique_dispatch
cd "${WS_WATCHER}"
echo "$i" > "next_dwn"
-rm -f manual_urls
+rm -f unique_dispatch modified_urls manual_urls
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
-export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.."
+export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
. "${TSP_DIR}/common.sh"
# Assume workspaces are stored on root partition.
# Get diskspace usage for root mountpoint.
-PER=`df -Ph | grep -o "[0-9][0-9]%.*/$"`
+PER="$(df -Ph | grep -o "[0-9][0-9]%.*/$")"
# Leave only numerical value.
-PER=${PER%\%*}
+PER="${PER%\%*}"
if [ "$PER" -ge 70 ]
then
- nr=$(tsmaster -L DISK_CLEANUP sh "${TSP_DIR}/scripts/free_diskspace.sh")
+ nr="$(tsmaster -L DISK_CLEANUP sh "${TSP_DIR}/scripts/free_diskspace.sh")"
# make the above job urgent
tsmaster -u "$nr"
fi
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
-export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.."
+export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
. "${TSP_DIR}/common.sh"
touch timestamp
touch timestamp_snapshot
nr=$(tspoll -L PRERELEASE_WATCHER timeout 120 "${TSP_DIR}/scripts/crawler.py" --log INFO "http://download.tizen.org/prerelease/tizen/common/")
-nr=$(tspoll -D $nr -L DOWNLOAD_TRIGGER sh "${TSP_DIR}/jobs/trigger_downloads.sh")
-nr=$(tspoll -D $nr -L SNAPSHOT_WATCHER timeout 120 "${TSP_DIR}/scripts/crawler.py" --log INFO "http://download.tizen.org/snapshots/tizen/common/")
-tspoll -D $nr -L DOWNLOAD_TRIGGER sh "${TSP_DIR}/jobs/trigger_downloads.sh"
+nr=$(tspoll -D "$nr" -L DOWNLOAD_TRIGGER sh "${TSP_DIR}/jobs/trigger_downloads.sh")
+nr=$(tspoll -D "$nr" -L SNAPSHOT_WATCHER timeout 120 "${TSP_DIR}/scripts/crawler.py" --log INFO "http://download.tizen.org/snapshots/tizen/common/")
+tspoll -D "$nr" -L DOWNLOAD_TRIGGER sh "${TSP_DIR}/jobs/trigger_downloads.sh"
TESTLAB_MAJOR="/opt/testlab-major"
-cd "${WORKDIR_REMOTE}"
+cd "${WORKDIR_REMOTE}" || exit
case "$TARGET" in
*odroid*)
- BOOT_IMG="`pwd`/`ls tizen-common_*-boot-*.tar.gz`"
- USR_IMG="`pwd`/`ls tizen-common_*-wayland-*.tar.gz`"
+ BOOT_IMG="$(pwd)/$(ls tizen-common_*-boot-*.tar.gz)"
+ USR_IMG="$(pwd)/$(ls tizen-common_*-wayland-*.tar.gz)"
;;
*minnow*)
- USR_IMG="`pwd`/`ls tizen-common_*_common-*-sda.raw.bz2`"
- USR_IMG_BMAP="`pwd`/`ls tizen-common_*_common-*-sda.bmap`"
+ USR_IMG="$(pwd)/$(ls tizen-common_*_common-*-sda.raw.bz2)"
+ USR_IMG_BMAP="$(pwd)/$(ls tizen-common_*_common-*-sda.bmap)"
;;
esac
# Make sure that userspace image exists
-if [ "${USR_IMG}" = "`pwd`/" ]; then
+if [ "${USR_IMG}" = "$(pwd)/" ]; then
echo "Image not found." > sysctl.result
exit 1
else
case "$TARGET" in
*odroid*)
- ${TESTLAB_MAJOR}/tct/odroid_prepare_flash_conf.sh "$SDMUX" "$USR_IMG" "$BOOT_IMG"
+ "${TESTLAB_MAJOR}/tct/odroid_prepare_flash_conf.sh" "$SDMUX" "$USR_IMG" "$BOOT_IMG"
;;
*minnow*)
- ${TESTLAB_MAJOR}/tct/minnow_prepare_flash_conf.sh "$SDMUX" "$USR_IMG"
+ "${TESTLAB_MAJOR}/tct/minnow_prepare_flash_conf.sh" "$SDMUX" "$USR_IMG"
;;
esac
# save discovered URLs for dispatching download requests
modified = get_modified_paths(discovered, timestamp_file)
with open(discovered_urls, 'w') as f:
- f.write('\n'.join(modified))
+ f.write('\n'.join(modified) + '\n')
# save all URLs for storing download history
dispatched |= modified
# Assume that most of the space is taken up by downloaded images.
# Delete ones that were modified at least 3 days ago.
-export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.."
+export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
. "${TSP_DIR}/common.sh"
for i in $(find "${WS_DOWNLOAD}" -maxdepth 1 -mindepth 1 -type d -mtime +1)
do
- DIFF_FILE="$(ls $i/diff-*.report)"
+ DIFF_FILE="$(ls "$i"/diff-*.report)"
if [ -z "${DIFF_FILE}" ]
then
echo "Missing diff-*.report in: " "$i"
#!/bin/sh
-echo $@ >> /tmp/testlab.log
+echo "$@" >> /tmp/testlab.log
cd "$WORKSPACE"
### Project list
-FULL_PROJECT="`head -1 project.conf`"
+FULL_PROJECT="$(head -1 project.conf)"
PROJECT="${FULL_PROJECT##*_}"
PAGE="Image test results"
-echo -n "" > "${OUTPUT}"
-echo "${PAGE_START}" >> "${OUTPUT}"
-echo "${TITLE_TAG}${PAGE}${TITLE_TAG}" >> "${OUTPUT}"
-echo '[['"${PROJECT}"']]' >> "${OUTPUT}"
-echo "" >> "${OUTPUT}"
-echo "${PAGE_END}" >> "${OUTPUT}"
+{
+ echo "${PAGE_START}"
+ echo "${TITLE_TAG}${PAGE}${TITLE_TAG}"
+ echo '[['"${PROJECT}"']]'
+ echo ""
+ echo "${PAGE_END}"
+} > "${OUTPUT}"
python3 /srv/pwb/pwb.py get "${PAGE}" | grep "\[\[${PROJECT}\]\]" \
|| python3 /srv/pwb/pwb.py pagefromfile -start:"${PAGE_START}" -end:"${PAGE_END}" -appendtop \
### Detailed project page
PAGE="${PROJECT}"
-echo -n "" > "${OUTPUT}"
-echo "${PAGE_START}" >> "${OUTPUT}"
-echo "${TITLE_TAG}${PAGE}${TITLE_TAG}" >> "${OUTPUT}"
+{
+ echo "${PAGE_START}"
+ echo "${TITLE_TAG}${PAGE}${TITLE_TAG}"
+} > "${OUTPUT}"
tail -2 project.conf >> "${OUTPUT}" || echo "No project"
awk '{print " "$0}' sysctl.result >> "${OUTPUT}" || echo "No sysctl"
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
-export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)"
+export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)"
. "${TSP_DIR}/common.sh"
echo "[$@] Kill every running job"
for i in $(eval $@ | grep "running" | grep -o "^[0-9]*")
do
- kill `eval $@ -p $i`
+ kill "$(eval $@ -p "$i")"
done
}
echo "[$@] Remove every queued job"
for i in $(eval $@ | grep "queued" | grep -o "^[0-9]*")
do
- eval $@ -r $i
+ eval $@ -r "$i"
done
}