From 418ed448ad6760015947958a80767a513460d671 Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Thu, 13 Jul 2017 03:20:33 +0000 Subject: jjb/common: add LAVA templating for QEMU LAVA jobs for QEMU have some slight differences compared to u-boot jobs. Add templating to support QEMU jobs for any arch. Change-Id: I6ef8e92cc169d8365f0ba1cb568b961d49e2a74f Signed-off-by: Kevin Hilman --- jjb/common/include-agl-run-test-prepare.sh | 6 ++-- jjb/common/include-agl-run-test-short.sh | 50 +++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 6 deletions(-) (limited to 'jjb/common') diff --git a/jjb/common/include-agl-run-test-prepare.sh b/jjb/common/include-agl-run-test-prepare.sh index b861a360..31aeadbf 100644 --- a/jjb/common/include-agl-run-test-prepare.sh +++ b/jjb/common/include-agl-run-test-prepare.sh @@ -4,7 +4,7 @@ ################################################################################ ## Run SHORT CI test ################################################################################ -#set -x +set -x #ls -alh #pwd @@ -49,11 +49,13 @@ if [ ! -e $TESTJOBFILE ] ; then fi # some defaults +export DEVICE_ARCH=arm export DEVICE_TYPE=raspberrypi3-uboot export DEVICE_NAME=raspberrypi3 export DEVICE_DTB=uImage-bcm2710-rpi-3-b.dtb export DEVICE_KERNEL=uImage export DEVICE_INITRAMFS=initramfs-netboot-image-raspberrypi3.ext4 +export DEVICE_INITRAMFS_COMPRESSION=false export DEVICE_NBDROOT=agl-demo-platform-raspberrypi3.ext4 export DEVICE_NBDROOT_COMPRESSION=false export DEVICE_BOOT_METHOD=u-boot @@ -62,7 +64,7 @@ export DEVICE_URL_PREFIX='https://download.automotivelinux.org/AGL/upload/ci/' # import device defaults. Format 'a=b' -for i in DEVICE_TYPE DEVICE_NAME DEVICE_DTB DEVICE_KERNEL DEVICE_INITRAMFS DEVICE_NBDROOT DEVICE_NBDROOT_COMPRESSION DEVICE_BOOT_METHOD DEVICE_BOOT_TYPE DEVICE_URL_PREFIX; do +for i in DEVICE_ARCH DEVICE_TYPE DEVICE_NAME DEVICE_DTB DEVICE_KERNEL DEVICE_INITRAMFS DEVICE_INITRAMFS_COMPRESSION DEVICE_NBDROOT DEVICE_NBDROOT_COMPRESSION DEVICE_BOOT_METHOD DEVICE_BOOT_TYPE DEVICE_URL_PREFIX DEVICE_QEMU_ARGS DEVICE_KERNEL_CMDLINE; do if grep -q ^$i $ENVFILE ; then X=$(grep $i $ENVFILE | sed -e "s#${i}=##g" -e "s#;.*##g") eval export ${i}=${X} diff --git a/jjb/common/include-agl-run-test-short.sh b/jjb/common/include-agl-run-test-short.sh index 6897fde5..bdbd2283 100644 --- a/jjb/common/include-agl-run-test-short.sh +++ b/jjb/common/include-agl-run-test-short.sh @@ -25,10 +25,6 @@ cat < testjob.yaml device_type: @REPLACE_DEVICE_TYPE@ job_name: AGL-short-smoke -protocols: - lava-xnbd: - port: auto - timeouts: job: minutes: 30 @@ -38,6 +34,14 @@ timeouts: minutes: 5 priority: medium visibility: public +EOF + +if [ ${DEVICE_BOOT_METHOD} = "u-boot" ]; then +cat <> testjob.yaml + +protocols: + lava-xnbd: + port: auto # ACTION_BLOCK actions: @@ -69,19 +73,57 @@ actions: username: root EOF +fi + +if [ ${DEVICE_BOOT_METHOD} = "qemu" ]; then +cat <>testjob.yaml +context: + no_kvm: true + arch: @REPLACE_DEVICE_ARCH@ + extra_options: [@REPLACE_QEMU_ARGS@] + +actions: +- deploy: + timeout: + minutes: 3 + to: tmpfs + os: oe + images: + kernel: + image_arg: '-kernel {kernel} -append @REPLACE_KERNEL_CMDLINE@' + url: '@REPLACE_URL_PREFIX@/@REPLACE_KERNEL@' + ramdisk: + image_arg: '-drive format=raw,file={ramdisk}' + url: '@REPLACE_URL_PREFIX@/@REPLACE_INITRAMFS@' + compression: @REPLACE_INITRAMFS_COMPRESSION@ + +- boot: + method: @REPLACE_BOOT_METHOD@ + media: tmpfs + prompts: ["root@@REPLACE_MACHINE@:~"] + auto_login: + login_prompt: "login:" + username: root + +EOF +fi CHID=${GERRIT_CHANGE_NUMBER}/${GERRIT_PATCHSET_NUMBER}/${MACHINE} # REPLACE_DEVICE_TYPE +sed -i -e "s#@REPLACE_DEVICE_ARCH@#${DEVICE_ARCH}#g" testjob.yaml sed -i -e "s#@REPLACE_DEVICE_TYPE@#${DEVICE_TYPE}#g" testjob.yaml sed -i -e "s#@REPLACE_DTB@#${CHID}/${DEVICE_DTB}#g" testjob.yaml sed -i -e "s#@REPLACE_KERNEL@#${CHID}/${DEVICE_KERNEL}#g" testjob.yaml sed -i -e "s#@REPLACE_INITRAMFS@#${CHID}/${DEVICE_INITRAMFS}#g" testjob.yaml +sed -i -e "s#@REPLACE_INITRAMFS_COMPRESSION@#${DEVICE_INITRAMFS_COMPRESSION}#g" testjob.yaml sed -i -e "s#@REPLACE_NBDROOT@#${CHID}/${DEVICE_NBDROOT}#g" testjob.yaml sed -i -e "s#@REPLACE_NBDROOT_COMPRESSION@#${DEVICE_NBDROOT_COMPRESSION}#g" testjob.yaml sed -i -e "s#@REPLACE_BOOT_METHOD@#${DEVICE_BOOT_METHOD}#g" testjob.yaml sed -i -e "s#@REPLACE_BOOT_TYPE@#${DEVICE_BOOT_TYPE}#g" testjob.yaml sed -i -e "s#@REPLACE_MACHINE@#${DEVICE_NAME}#g" testjob.yaml sed -i -e "s#@REPLACE_URL_PREFIX@#${DEVICE_URL_PREFIX}#g" testjob.yaml +sed -i -e "s#@REPLACE_QEMU_ARGS@#${DEVICE_QEMU_ARGS}#g" testjob.yaml +sed -i -e "s#@REPLACE_KERNEL_CMDLINE@#${DEVICE_KERNEL_CMDLINE}#g" testjob.yaml cat testjob.yaml -- cgit 1.2.3-korg