summaryrefslogtreecommitdiff
path: root/tsp/scripts
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-08-26 14:43:02 (GMT)
committerAleksander Mistewicz <a.mistewicz@samsung.com>2016-12-06 15:37:13 (GMT)
commitd67067c8c0167e53b2adc58f3c3bc381c3bfdb50 (patch)
treeef7004b10f2977dff46f959a7db949b407f785d2 /tsp/scripts
parent6846bcb275df7f55c786c28854b1c7e564a7bd3e (diff)
downloadmajor-d67067c8c0167e53b2adc58f3c3bc381c3bfdb50.zip
major-d67067c8c0167e53b2adc58f3c3bc381c3bfdb50.tar.gz
major-d67067c8c0167e53b2adc58f3c3bc381c3bfdb50.tar.bz2
Fix issues reported by ShellCheck in tsprefs/changes/31/81831/12
Move check_diff() to tsp/jobs/img_test_common.sh Add newline at the end of 'modifed_paths' in tsp/scripts/crawler.py so that whole lines instead of words can be read. ShellCheck: https://github.com/koalaman/shellcheck shellcheck -e SC1090,SC2155,SC2068,SC2145,SC2164 `find tsp -name "*.sh"` output should report following problems only: tsp/common.sh: SC2148, SC2034, SC2139 tsp/jobs/trigger_downloads.sh: SC2115 tsp/jobs/common_prep_flash_conf.sh: SC2029 tsp/jobs/publish.sh: SC2046, SC2029 Change-Id: I7791769a0d653c784715cdd1a8b1446fafcba1e9 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tsp/scripts')
-rwxr-xr-xtsp/scripts/common_prep_flash_conf.sh16
-rwxr-xr-xtsp/scripts/crawler.py2
-rwxr-xr-xtsp/scripts/free_diskspace.sh4
-rwxr-xr-xtsp/scripts/log.sh2
-rwxr-xr-xtsp/scripts/publish.sh22
5 files changed, 24 insertions, 22 deletions
diff --git a/tsp/scripts/common_prep_flash_conf.sh b/tsp/scripts/common_prep_flash_conf.sh
index 07e3d46..d940823 100755
--- a/tsp/scripts/common_prep_flash_conf.sh
+++ b/tsp/scripts/common_prep_flash_conf.sh
@@ -22,20 +22,20 @@
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
@@ -53,10 +53,10 @@ fi
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
diff --git a/tsp/scripts/crawler.py b/tsp/scripts/crawler.py
index bbc6704..7f73075 100755
--- a/tsp/scripts/crawler.py
+++ b/tsp/scripts/crawler.py
@@ -137,7 +137,7 @@ if '__main__' == __name__:
# 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
diff --git a/tsp/scripts/free_diskspace.sh b/tsp/scripts/free_diskspace.sh
index 566005c..9adf7d6 100755
--- a/tsp/scripts/free_diskspace.sh
+++ b/tsp/scripts/free_diskspace.sh
@@ -19,13 +19,13 @@
# 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"
diff --git a/tsp/scripts/log.sh b/tsp/scripts/log.sh
index bd29684..32e2829 100755
--- a/tsp/scripts/log.sh
+++ b/tsp/scripts/log.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-echo $@ >> /tmp/testlab.log
+echo "$@" >> /tmp/testlab.log
diff --git a/tsp/scripts/publish.sh b/tsp/scripts/publish.sh
index 523bb6c..ffe18b6 100755
--- a/tsp/scripts/publish.sh
+++ b/tsp/scripts/publish.sh
@@ -25,16 +25,17 @@ WORKSPACE="/home/jenkins/pub"
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 \
@@ -43,9 +44,10 @@ python3 /srv/pwb/pwb.py get "${PAGE}" | grep "\[\[${PROJECT}\]\]" \
### 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"