jjb/common: LAVA submit: : support device-type alternate names 11/10511/1
authorKevin Hilman <khilman@baylibre.com>
Mon, 26 Jun 2017 22:03:14 +0000 (22:03 +0000)
committerKevin Hilman <khilman@baylibre.com>
Fri, 4 Aug 2017 17:56:12 +0000 (17:56 +0000)
The LAVA device types used in AGL lab are different than the standard
LAVA device-type names (which tend to follow naming conventions from
the upstream linux kernel device-tree names.)

This patch enables a way to have a table of alternate names, using the
rpi3 as an example.

Change-Id: Ic52d124047ef1c831c992c5671b1ad4b7d5f51ab
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
jjb/common/include-agl-lava-jobs-submit.sh

index 8de2c78..d8578d3 100644 (file)
@@ -14,11 +14,20 @@ JOB_BASE=$(basename $JOB_FILE .yaml)
 
 # find device_type from job file
 line=$(grep ^device_type: $JOB_FILE | tr -d '[:space:]')
-device_type=${line/device_type:/}
-echo "Found device_type $device_type in LAVA job $JOB_FILE"
+__device_type=${line/device_type:/}
+echo "Found device_type $__device_type in LAVA job $JOB_FILE"
+
+declare -A dt_aliases
+dt_aliases=(
+    [raspberrypi3-uboot]="bcm2837-rpi-3-b"
+)
+device_types=$__device_type
+device_types+=" "
+device_types+=${dt_aliases[$__device_type]}
 
 # iterate over available labs
 for lab in "${!labs[@]}"; do
+  for device_type in $device_types; do
     val=${labs[$lab]}
     OFS=${IFS}
     IFS=';'
@@ -56,12 +65,16 @@ for lab in "${!labs[@]}"; do
     else
        echo " Found and available.  Status: $device_status"
     fi
+    
+    # Need to hack the real device-type name in the job file
+    JOB_FILE_NEW="${JOB_BASE}_${lab}.yaml"
+    cat $JOB_FILE | sed "s/device_type: $__device_type/device_type: $device_type/" > $JOB_FILE_NEW
 
     #
     # LAVA job submit, get job ID and status from lava-tool output
     #
     JOB_STATUS="${JOB_BASE}_${lab}.status"
-    lava-tool submit-job --block $full_url $JOB_FILE |tee $JOB_STATUS
+    lava-tool submit-job --block $full_url $JOB_FILE_NEW |tee $JOB_STATUS
 
     IFS=':'
     line=$(grep "job id" $JOB_STATUS | tr -d '[:space:]')
@@ -93,7 +106,9 @@ for lab in "${!labs[@]}"; do
     else
        continue
     fi
+  done
 done
 
 # if we get here, none of the labs had a successful completion
 exit 1
+