aboutsummaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authorLoys Ollivier <lollivier@baylibre.com>2017-12-14 11:31:20 +0100
committerLoys Ollivier <lollivier@baylibre.com>2017-12-15 11:08:52 +0100
commit7f61f12d910291676dc5a90e2b9bf7874d58843b (patch)
treeefcea7cf0d08ea7054e33d249ab82881c238dc3e /jjb
parent712b17b970b69dce76f3203557997ec42dcda845 (diff)
jjb/common: Fix race condition when using grep and tr
when using grep + tr to find board availability, status, a race condition happens sometimes. When it happens the job is stuck and timeout fails. Fix it by calling sequentially grep then tr and not piping. Change-Id: Ib1322e280900b62abdd827992b42183024cd094c Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
Diffstat (limited to 'jjb')
-rw-r--r--jjb/common/include-agl-lava-jobs-submit.sh3
-rw-r--r--jjb/common/include-agl-lava-labs-prepare.sh4
2 files changed, 5 insertions, 2 deletions
diff --git a/jjb/common/include-agl-lava-jobs-submit.sh b/jjb/common/include-agl-lava-jobs-submit.sh
index 217e8da9..3703ce5b 100644
--- a/jjb/common/include-agl-lava-jobs-submit.sh
+++ b/jjb/common/include-agl-lava-jobs-submit.sh
@@ -31,7 +31,8 @@ job_id=$(grep "submitted as job:" $JOB_STATUS | sed 's/.*\/\([0-9]*$\)/\1/')
lava-tool job-details $full_url $job_id | tee $JOB_STATUS
IFS=':'
-line=$(grep "^status:" $JOB_STATUS | tr -d '[:space:]')
+line=$(grep "^status:" $JOB_STATUS)
+line=$(echo "$line" | tr -d '[:space:]')
arr=($line)
status=${arr[1]}
IFS=${OFS}
diff --git a/jjb/common/include-agl-lava-labs-prepare.sh b/jjb/common/include-agl-lava-labs-prepare.sh
index 0b54f9f7..f02a2b3f 100644
--- a/jjb/common/include-agl-lava-labs-prepare.sh
+++ b/jjb/common/include-agl-lava-labs-prepare.sh
@@ -68,7 +68,9 @@ for lab in "${!labs[@]}"; do
# Find the LAVA Lab that has the device available to run the job
echo -n "Checking for $lava_device at $full_url... "
- line=$(lava-tool devices-list $full_url |grep $lava_device | tr -d '[:space:]')
+ line=$(lava-tool devices-list $full_url | grep $lava_device)
+ line=$(echo "$line" | tr -d '[:space:]')
+
if [ -z "$line" ]; then
echo "not found."
continue