diff options
author | Pawel Wieczorek <p.wieczorek2@samsung.com> | 2018-08-31 15:20:23 +0200 |
---|---|---|
committer | Pawel Wieczorek <p.wieczorek2@samsung.com> | 2018-11-19 17:03:23 +0100 |
commit | aa6072e40206da8cebdca9c3705a0a48a27c91ea (patch) | |
tree | a49a60bf1f11fe0dd5bd393c49f6354043619a91 | |
parent | a8b0b764fbb5546f13b367391663577a95b0e7b2 (diff) | |
download | host-aa6072e40206da8cebdca9c3705a0a48a27c91ea.tar.gz host-aa6072e40206da8cebdca9c3705a0a48a27c91ea.tar.bz2 host-aa6072e40206da8cebdca9c3705a0a48a27c91ea.zip |
Import useful shell aliases for testlab maintenance
Credit: Aleksander Mistewicz <a.mistewicz@samsung.com>
This patch also applies POSIX compliance and Google Shell Style Guide.
Relevant:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#dot
https://google.github.io/styleguide/shell.xml#Function_Names
Change-Id: I3a1e41d4aa878cac0855f0953e8991662a8896a9
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
-rw-r--r-- | util/aliases | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/util/aliases b/util/aliases new file mode 100644 index 0000000..6329c74 --- /dev/null +++ b/util/aliases @@ -0,0 +1,54 @@ +# This file contains shell aliases to make working with testlab less painful. +# Linking it to ~/.bash_aliases file might prove itself useful. + +. /opt/testlab-major/tsp/common.sh + +# hurry makes requested task from given target queue urgent, i.e. moves it to +# the front of said queue; it takes two mandatory arguments: +# - target queue name +# - task number (its ID) +hurry() { + local target="$1" + local nr="$2" + test -n "$target" || echo "Missing argument: target" + test -n "$nr" || echo "Missing argument: nr" + tsrun_target $target -u `tsrun_target $target | grep $nr | cut -d' ' -f 1` +} + +# redownload forces downloading all images from requested prerelease/snapshot +# project again; it takes one mandatory argument: +# - project URL (its root; remember that it must end with slash!) +redownload() { + echo "$1" >> $WS_WATCHER/manual_urls +} + +# get_device retrieves device name from results database for requested task +# number (helper for retry, see below); it takes one mandatory argument: +# - task number (its ID) +get_device() { + local nr="$1" + test -n "$nr" || echo "Missing argument: nr" + sqlite3 ~/ws/publish/results.db3 "SELECT device.dname FROM test INNER JOIN device ON test.tdid = device.did WHERE tbuildnr = $nr;" +} + +# retry forces rescheduling requested task; it takes one mandatory argument: +# - task number (its ID) +retry() { + local target="$1" + local nr="$2" + test -n "$target" || echo "Missing argument: target" + test -n "$nr" || echo "Missing argument: nr" + tsrun_target $target sh /opt/testlab-major/tsp/jobs/../jobs/common_prep_flash_conf.sh $nr "$(get_device $nr)" +} + +# retrigger forces rescheduling requested task; it takes two mandatory +# arguments: +# - task number (its ID) +# - target queue name +retrigger() { + local nr="$1" + local target="$2" + test -n "$nr" || echo "Missing argument: nr" + test -n "$target" || echo "Missing argument: target" + tsmaster sh /opt/testlab-major/tsp/jobs/img_test_common.sh "$nr" "$target" +} |