From 38f5f68c07945d8fed69622d1ffc5295ef9d536d Mon Sep 17 00:00:00 2001 From: Xavier Claessens <xavier.claessens@collabora.com> Date: Thu, 17 Sep 2015 13:18:17 -0400 Subject: [PATCH] tumbler: inline a common sh file used only from one place Differential Revision: https://phabricator.apertis.org/D532 --- common/common.sh | 14 -------------- common/thumbnailer-utils.sh | 15 --------------- tumbler/automated/run-test.sh | 24 +++++++++++++++++++++++- 3 files changed, 23 insertions(+), 30 deletions(-) delete mode 100644 common/thumbnailer-utils.sh diff --git a/common/common.sh b/common/common.sh index b5f28cf..311750e 100644 --- a/common/common.sh +++ b/common/common.sh @@ -113,20 +113,6 @@ setup_failure() { exit 1 } -######################## -# Conversion Utilities # -######################## -# Converts bash arrays to "as" GVariant arrays -bash_arrays_to_gvariant_as() { - local i converted="['$1'" - shift - for i in "$@"; do - converted+=", '$i'" - done - converted+="]" - echo "${converted}" -} - ############# # Utilities # ############# diff --git a/common/thumbnailer-utils.sh b/common/thumbnailer-utils.sh deleted file mode 100644 index 14cc478..0000000 --- a/common/thumbnailer-utils.sh +++ /dev/null @@ -1,15 +0,0 @@ -# Source me! -# vim: set sts=4 sw=4 et : - -_check_uris_have_thumbnail() { - local size=$1 - local uris=$2 - for i in "${uris[@]}"; do - local thumb="${HOME}/.cache/thumbnails/${size}/$(echo -n "${i}" | md5sum | cut -f1 -d\ ).png" - say $thumb - if [[ ! -f "${thumb}" ]]; then - whine "Couldn't find thumbnail $thumb, file $i didn't get thumbnailed!?" - ret=1 - fi - done -} diff --git a/tumbler/automated/run-test.sh b/tumbler/automated/run-test.sh index dda47ea..fb6684c 100755 --- a/tumbler/automated/run-test.sh +++ b/tumbler/automated/run-test.sh @@ -5,7 +5,6 @@ set -e TESTDIR=$(cd $(dirname $0); pwd; cd - &>/dev/null) . "${TESTDIR}/config.sh" -. "${TESTDIR}/../../common/thumbnailer-utils.sh" ######### # Setup # @@ -40,6 +39,29 @@ _kill_monitor_return() { return $1 } +bash_arrays_to_gvariant_as() { + local i converted="['$1'" + shift + for i in "$@"; do + converted+=", '$i'" + done + converted+="]" + echo "${converted}" +} + +_check_uris_have_thumbnail() { + local size=$1 + local uris=$2 + for i in "${uris[@]}"; do + local thumb="${HOME}/.cache/thumbnails/${size}/$(echo -n "${i}" | md5sum | cut -f1 -d\ ).png" + say $thumb + if [[ ! -f "${thumb}" ]]; then + whine "Couldn't find thumbnail $thumb, file $i didn't get thumbnailed!?" + ret=1 + fi + done +} + _generate_thumbnails() { set -x local i ret size files logfile addr obj_path method uris filetypes -- GitLab