diff --git a/libs/devlib b/libs/devlib index 724c0ec8dfc6da8f87d253ebd8020ad35b0ab347..f0b58b32c4fd7b6dc33c8a3f27fa8918e1023e69 160000 --- a/libs/devlib +++ b/libs/devlib @@ -1 +1 @@ -Subproject commit 724c0ec8dfc6da8f87d253ebd8020ad35b0ab347 +Subproject commit f0b58b32c4fd7b6dc33c8a3f27fa8918e1023e69 diff --git a/libs/utils/env.py b/libs/utils/env.py index 2cd08b8626423b255214135c06f9ee1c2c63af8f..ca025c23800e0081256b4ac14121744695066f63 100644 --- a/libs/utils/env.py +++ b/libs/utils/env.py @@ -537,7 +537,8 @@ class TestEnv(ShareState): self._log.debug('Setup HOST target...') self.target = devlib.LocalLinuxTarget( platform = platform, - working_directory = self.workdir, + working_directory = '/tmp/devlib-target', + executables_directory = '/tmp/devlib-target/bin', load_default_modules = False, modules = self.__modules, connection_settings = {'unrooted': True}) diff --git a/tests/lisa/test_wlgen.py b/tests/lisa/test_wlgen.py index e585aa480ae7ce21d35fbfbd0ceacd10962730fb..1d2060c8223ea6e4e60f5bdfc3d395c8a41dd9a8 100644 --- a/tests/lisa/test_wlgen.py +++ b/tests/lisa/test_wlgen.py @@ -36,6 +36,8 @@ class TestTarget(LocalLinuxTarget): def __init__(self): self.execute_calls = [] super(TestTarget, self).__init__(platform=Platform(), + working_directory = '/tmp/devlib-target', + executables_directory = '/tmp/devlib-target/bin', load_default_modules=False, connection_settings={'unrooted': True}) diff --git a/tools/wa_user_directory/config.yaml b/tools/wa_user_directory/config.yaml index 7b9579c58db44b58a12cc8c8c47f5ce68bf31264..8f1b026555a0ab3291a09a3cd2242b1857897ec1 100644 --- a/tools/wa_user_directory/config.yaml +++ b/tools/wa_user_directory/config.yaml @@ -13,4 +13,4 @@ max_retries: 0 bail_on_init_failure: false # Default result processors -result_processors: ['csv', 'status'] +output_processors: ['csv', 'status'] diff --git a/tools/wltests/agendas/sched-evaluation-full-traced.yaml b/tools/wltests/agendas/sched-evaluation-full-traced.yaml index 8e47901d2198ad84cdd9ff91a587e9c3e787431b..c74f46ee63b1a2fecfe1e1424d960a01437faea8 100644 --- a/tools/wltests/agendas/sched-evaluation-full-traced.yaml +++ b/tools/wltests/agendas/sched-evaluation-full-traced.yaml @@ -59,6 +59,7 @@ workloads: workload_parameters: format: "mov_720p" duration: 30 + landscape: True # Play 30 seconds of a OGG Vorbis audio with Exoplayer - name: exoplayer diff --git a/tools/wltests/agendas/sched-evaluation-full.yaml b/tools/wltests/agendas/sched-evaluation-full.yaml index 98a4863e2e615854d517e63a6d6d909116084b93..c939bae3add39120f0832ceb6902a2356f21c409 100644 --- a/tools/wltests/agendas/sched-evaluation-full.yaml +++ b/tools/wltests/agendas/sched-evaluation-full.yaml @@ -58,6 +58,7 @@ workloads: tag: mov_720p_30s workload_parameters: format: "mov_720p" + landscape: True duration: 30 # Play 30 seconds of a OGG Vorbis audio with Exoplayer diff --git a/tools/wltests/agendas/sched-evaluation-small.yaml b/tools/wltests/agendas/sched-evaluation-small.yaml index 542ddcc208164250542b72d22d0462a638787386..086fb94c65bc0a78f50bf4a774eaf7fd39a9d619 100644 --- a/tools/wltests/agendas/sched-evaluation-small.yaml +++ b/tools/wltests/agendas/sched-evaluation-small.yaml @@ -59,6 +59,7 @@ workloads: workload_parameters: format: "mov_720p" duration: 3 + landscape: True # Play 30 seconds of a OGG Vorbis audio with Exoplayer - name: exoplayer diff --git a/tools/wltests/build b/tools/wltests/build index 6fea5dfc346985fda2fefb636abfb901e40e058e..31619859db913642eb1d6d1c3f722c6bc6c673b6 100755 --- a/tools/wltests/build +++ b/tools/wltests/build @@ -47,6 +47,8 @@ usage() { -t, --dtbs make dtbs -x, --clean_all make distclean, remove toolchain --modules make modules + --modules_install make modules_install to INSTALL_MOD_PATH + --dtbo_image make dtbo.img -a, --use-ccache prepend 'ccache' to CROSS_COMPILE -k, --keepconfig keep exiting .config, i.e. no other config is applied @@ -72,7 +74,9 @@ MAKE_MENUCONFIG=$NO MAKE_SAVEDEFCONFIG=$NO MAKE_KEEPCONFIG=$NO BUILD_DTBS=$NO +BUILD_DTBO_IMAGE=$NO BUILD_MODULES=$NO +BUILD_MODULES_INSTALL=$NO BUILD_IMAGE=$NO CLEAN_KERNEL=$NO DISTCLEAN_KERNEL=$NO @@ -115,13 +119,18 @@ while [[ $# -gt 0 ]]; do -t|--dtbs) BUILD_DTBS=$YES ;; + --dtbo_image) + BUILD_DTBO_IMAGE=$YES + ;; -x|--clean_all) CLEAN_ALL=$YES ;; --modules) BUILD_MODULES=$YES ;; - + --modules_install) + BUILD_MODULES_INSTALL=$YES + ;; -a|--use-ccache) USE_CCACHE=$YES ;; @@ -158,17 +167,19 @@ format_conf() { # Print information about behavior echo c_info "Build configuration:" -c_info " Menuconfig : $(format_conf ${MAKE_MENUCONFIG})" -c_info " Savedefconfig : $(format_conf ${MAKE_SAVEDEFCONFIG})" -c_info " Keepconfig : $(format_conf ${MAKE_KEEPCONFIG})" -c_info " Build full : $(format_conf ${BUILD_NOW})" -c_info " Build Image : $(format_conf ${BUILD_IMAGE})" -c_info " Build dtbs : $(format_conf ${BUILD_DTBS})" -c_info " Build modules : $(format_conf ${BUILD_MODULES})" -c_info " Clean : $(format_conf ${CLEAN_KERNEL})" -c_info " Distclean : $(format_conf ${DISTCLEAN_KERNEL})" -c_info " Clean all : $(format_conf ${CLEAN_ALL})" -c_info " Use ccache : $(format_conf ${USE_CCACHE})" +c_info " Menuconfig : $(format_conf ${MAKE_MENUCONFIG})" +c_info " Savedefconfig : $(format_conf ${MAKE_SAVEDEFCONFIG})" +c_info " Keepconfig : $(format_conf ${MAKE_KEEPCONFIG})" +c_info " Build full : $(format_conf ${BUILD_NOW})" +c_info " Build Image : $(format_conf ${BUILD_IMAGE})" +c_info " Build dtbs : $(format_conf ${BUILD_DTBS})" +c_info " Build dtbo.img : $(format_conf ${BUILD_DTBO_IMAGE})" +c_info " Build modules : $(format_conf ${BUILD_MODULES})" +c_info " Build modules_install : $(format_conf ${BUILD_MODULES_INSTALL})" +c_info " Clean : $(format_conf ${CLEAN_KERNEL})" +c_info " Distclean : $(format_conf ${DISTCLEAN_KERNEL})" +c_info " Clean all : $(format_conf ${CLEAN_ALL})" +c_info " Use ccache : $(format_conf ${USE_CCACHE})" # Load platform definitions source "${DEFINITIONS_PATH}" @@ -176,11 +187,12 @@ source "${DEFINITIONS_PATH}" # Print information about platform echo c_info "Platform configuration:" -c_info " PLATFORM_NAME : ${PLATFORM_NAME}" -c_info " DEFCONFIG : ${DEFCONFIG}" -c_info " CONFIG_CMD : ${CONFIG_CMD}" -c_info " ARCH : ${ARCH}" -c_info " CROSS_COMPILE : ${CROSS_COMPILE}" +c_info " PLATFORM_NAME : ${PLATFORM_NAME}" +c_info " DEFCONFIG : ${DEFCONFIG}" +c_info " CONFIG_CMD : ${CONFIG_CMD}" +c_info " ARCH : ${ARCH}" +c_info " CROSS_COMPILE : ${CROSS_COMPILE}" +c_info " MODULES_INSTALL_DIR : ${INSTALL_MOD_PATH}" ################################################################################ @@ -283,11 +295,21 @@ if [ ${BUILD_DTBS} -eq $YES ]; then (set -x; cd "${KERNEL_SRC}"; make -j${NCPUS} dtbs >${OUT}) fi +if [ ${BUILD_DTBO_IMAGE} -eq $YES ]; then + c_info "Making [dtbo.img]..." + (set -x; cd "${KERNEL_SRC}"; make -j${NCPUS} dtbo.img >${OUT}) +fi + if [ ${BUILD_MODULES} -eq $YES ]; then c_info "Making [modules]..." (set -x; cd "${KERNEL_SRC}"; make -j${NCPUS} modules >${OUT}) fi +if [ ${BUILD_MODULES_INSTALL} -eq $YES ]; then + c_info "Making [modules_install] to [${INSTALL_MOD_PATH}] ..." + (set -x; cd "${KERNEL_SRC}"; make -j${NCPUS} modules_install >${OUT}) +fi + if [ ${MAKE_MENUCONFIG} -eq $YES ]; then c_info "Making [menuconfig]..." (set -x; cd "${KERNEL_SRC}"; make menuconfig) diff --git a/tools/wltests/platforms/hikey620_android-4.4/flash_images b/tools/wltests/platforms/hikey620_android-4.4/flash_images index 926fde50e50ecbccc9c112203aeba7cb1a915507..af36af0145b656f67cd14c2d43aba0137bab6278 100755 --- a/tools/wltests/platforms/hikey620_android-4.4/flash_images +++ b/tools/wltests/platforms/hikey620_android-4.4/flash_images @@ -5,6 +5,9 @@ BASE_DIR="$SCRIPT_DIR/../.." source "${BASE_DIR}/helpers" source "${PLATFORM_PATH}/definitions" +MODE=${$1:-FASTBOOT} +[ $MODE == FASTBOOT ] || exit $OK + ################################################################################ # Build all images required to test a new kernel ################################################################################ diff --git a/tools/wltests/platforms/hikey960_android-4.4/flash_images b/tools/wltests/platforms/hikey960_android-4.4/flash_images index 926fde50e50ecbccc9c112203aeba7cb1a915507..af36af0145b656f67cd14c2d43aba0137bab6278 100755 --- a/tools/wltests/platforms/hikey960_android-4.4/flash_images +++ b/tools/wltests/platforms/hikey960_android-4.4/flash_images @@ -5,6 +5,9 @@ BASE_DIR="$SCRIPT_DIR/../.." source "${BASE_DIR}/helpers" source "${PLATFORM_PATH}/definitions" +MODE=${$1:-FASTBOOT} +[ $MODE == FASTBOOT ] || exit $OK + ################################################################################ # Build all images required to test a new kernel ################################################################################ diff --git a/tools/wltests/platforms/wahoo_android_v4.4/build_images b/tools/wltests/platforms/wahoo_android_v4.4/build_images new file mode 100755 index 0000000000000000000000000000000000000000..d8bc218f58ddf660e805e020c79299b6628053c0 --- /dev/null +++ b/tools/wltests/platforms/wahoo_android_v4.4/build_images @@ -0,0 +1,103 @@ +#!/bin/bash + +SCRIPT_DIR=$(dirname $(realpath -s $0)) +BASE_DIR="$SCRIPT_DIR/../.." +source "${BASE_DIR}/helpers" +source "${PLATFORM_PATH}/definitions" + +################################################################################ +# Utils +################################################################################ + +flatten_file() { + OUT_FILE="$1" + + MODULE_DIR=$(dirname $OUT_FILE) + FILE_NAME=$(basename $OUT_FILE) + IN_FILE=$(find . -name $FILE_NAME) + + cat $IN_FILE | \ + while read -r LINE; do + OUT_LINE="" + if [[ "$LINE" != "#"* ]]; then + read -a PARAMS <<< "${LINE}" + for ELEMENT in ${PARAMS[@]}; do + OUT_LINE="${OUT_LINE}$(basename ${ELEMENT}) " + done + OUT_LINE=$(sed 's/ *$//g' <<< ${OUT_LINE}) + else + OUT_LINE=$LINE + fi + echo "${OUT_LINE}" >> ${OUT_FILE} + done +} + +publish_modules() { + MODULE_DIR=$1 + + pushd ${INSTALL_MOD_PATH} + + echo + c_info "Generating modules descriptors:" + for OUT_FILE in modules.dep modules.order modules.alias; do + OUT_FILE="$MODULE_DIR/$OUT_FILE" + c_info "- $OUT_FILE" + flatten_file "$OUT_FILE" + done + + echo + c_info "Installing modules:" + find . -name *.ko | \ + while read KO; do + c_info "- ${MODULE_DIR}/$(basename $KO)" + cp $KO ${MODULE_DIR}/$(basename $KO) + done + + popd +} + +################################################################################ +# Build all images required to test a new kernel +################################################################################ + +echo +c_info "Cleaning ${ARTIFACTS_PATH}..." +rm -rf ${ARTIFACTS_PATH} + +# Local modules installation path +echo +c_info "Build all images and modules..." +export INSTALL_MOD_PATH=${ARTIFACTS_PATH}/modules +mkdir -p ${INSTALL_MOD_PATH} +./build --use-ccache --image --modules --modules_install --dtbo_image --silent; ERROR=$? +[ $ERROR -eq 0 ] || exit $ERROR + +# Check that all required images have been properly created +DTBO_IMAGE=$KERNEL_SRC/arch/arm64/boot/$KERNEL_DTBO +if [ ! -f $DTBO_IMAGE ]; then + c_error "DTB overlay [$DTBO_IMAGE] not generated" + exit $ENOENT +fi +KERNEL_IMAGE=$KERNEL_SRC/arch/arm64/boot/$KERNEL_IMAGE +if [ ! -f $KERNEL_IMAGE ]; then + c_error "Kernel [$KERNEL_IMAGE] not generated" + exit $ENOENT +fi + +echo +c_info "Publishing DTBO image $DTBO_IMAGE to:" +c_info " $ARTIFACTS_PATH/$ANDROID_DTBO_IMAGE" +cp $DTBO_IMAGE $ARTIFACTS_PATH/$ANDROID_DTBO_IMAGE + +echo +c_info "Publishing KERNEL image $KERNEL_IMAGE to:" +c_info " $ARTIFACTS_PATH/$(basename $KERNEL_IMAGE)" +cp $KERNEL_IMAGE $ARTIFACTS_PATH/$(basename $KERNEL_IMAGE) + +echo +MODULE_DIR="$ARTIFACTS_PATH/push_files/vendor/lib/modules" +mkdir -p ${MODULE_DIR} +c_info "Publishing MODULES to:" +c_info " $MODULE_DIR" +publish_modules ${MODULE_DIR} + diff --git a/tools/wltests/platforms/wahoo_android_v4.4/definitions b/tools/wltests/platforms/wahoo_android_v4.4/definitions new file mode 100644 index 0000000000000000000000000000000000000000..2281faddf80ea2dfff9b26a5f7e53b98fcc4250c --- /dev/null +++ b/tools/wltests/platforms/wahoo_android_v4.4/definitions @@ -0,0 +1,50 @@ + +################################################################################ +# Build definitions for Hikey960 +################################################################################ + +PLATFORM_NAME="Wahoo" + +################################################################################ +# Boot Image Configuration +################################################################################ + +KERNEL_IMAGE="${KERNEL_IMAGE:-Image.lz4-dtb}" +KERNEL_CMDLINE="${KERNEL_CMDLINE:-\ + androidboot.hardware=walleye\ + androidboot.console=ttyMSM0\ + lpm_levels.sleep_disabled=1\ + user_debug=31\ + msm_rtb.filter=0x37\ + ehci-hcd.park=3\ + service_locator.enable=1\ + swiotlb=2048\ + firmware_class.path=/vendor/firmware\ + loop.max_part=7\ + raid=noautodetect\ + buildvariant=userdebug\ +}" +RAMDISK_IMAGE="${RAMDISK_IMAGE:-ramdisk.gz}" # OPM1.170928.003 (4367109) +KERNEL_DTBO="${KERNEL_DTBO:-dtbo.img}" + +ANDROID_BOOT_IMAGE="${ANDROID_BOOT_IMAGE:-boot.img}" +ANDROID_IMAGE_BASE="${ANDROID_IMAGE_BASE:-0x80000000}" +ANDROID_IMAGE_PAGESIZE="${ANDROID_IMAGE_PAGESIZE:-4096}" +ANDROID_OS_VERSION="${ANDROID_OS_VERSION:-O}" +ANDROID_OS_PATCH_LEVEL="${ANDROID_OS_PATCH_LEVEL:-}" + +################################################################################ +# Device Tree Configuration +################################################################################ + +ANDROID_DTBO_IMAGE="${ANDROID_DTBO_IMAGE:-dtbo.img}" + +################################################################################ +# Toolchain Configuration +################################################################################ + +DEFCONFIG="${DEFCONFIG:-wahoo_defconfig}" +CONFIG_CMD="${CONFIG_CMD:-}" +ARCH="${ARCH:-arm64}" +CROSS_COMPILE="${CROSS_COMPILE:-aarch64-linux-android-}" + diff --git a/tools/wltests/platforms/wahoo_android_v4.4/flash_images b/tools/wltests/platforms/wahoo_android_v4.4/flash_images new file mode 100755 index 0000000000000000000000000000000000000000..b6fa00f0951df6a3c4e8de37c25d9f4627b196ef --- /dev/null +++ b/tools/wltests/platforms/wahoo_android_v4.4/flash_images @@ -0,0 +1,96 @@ +#!/bin/bash + +SCRIPT_DIR=$(dirname $(realpath -s $0)) +BASE_DIR="$SCRIPT_DIR/../.." +source "${BASE_DIR}/helpers" +source "${PLATFORM_PATH}/definitions" + +MODE=${1:-FASTBOOT} + +################################################################################ +# Flash all images required to test a new kernel +################################################################################ + +# Check for DTBO image +ls "${ARTIFACTS_PATH}/${ANDROID_DTBO_IMAGE}" &>/dev/null; ERROR=$? +if [ $ERROR -ne 0 ]; then + c_error "No DTBO image to flash found in $PWD" + exit $ENOENT +fi + +# Check for KERNEL image +ls "${ARTIFACTS_PATH}/${KERNEL_IMAGE}" &>/dev/null; ERROR=$? +if [ $ERROR -ne 0 ]; then + c_error "No KERNEL image to flash found in $PWD" + exit $ENOENT +fi + +# Check for modules to be pushed +MODULE_DIR="${ARTIFACTS_PATH}/push_files/vendor/lib/modules" +ls ${MODULE_DIR}/*.ko &>/dev/null; ERROR=$? +if [ $ERROR -ne 0 ]; then + c_error "No MODULES to push found in $MODULE_DIR" + exit $ENOENT +fi + +case "$MODE" in + +ADB) + echo + c_info "Restart ADB in root mode..." + $ADB root &>/dev/null + + # Verity must be disabled one time, right after the first boot, once a + # new set of stock images has been flashed on the device. + # This check is just there to ensure we can remount root rw, otherwise + # wltests will abort and the device must be rebooted by hand. + c_info "Checking that verity is disabled..." + OUTPUT="$($ADB disable-verity)" + echo + echo "$OUTPUT" + echo + if [[ $OUTPUT != *"verity is already disabled"* ]]; then + c_error "Verity not disabled on this device!" + c_warning "It has been disabled now but you have to" + c_warning "manually reboot your device and restart wltests" + echo + echo + exit $EIO + fi + + c_info "Remounting / rw..." + $ADB remount &>/dev/null; ERROR=$? + if [[ $ERROR -ne 0 ]]; then + c_error "Remount failed" + exit $EIO + fi + sleep 10 + + c_info "Pushing kernel modules..." + $ADB shell rm -rf /vendor/lib/modules + $ADB push ${ARTIFACTS_PATH}/push_files/* / + sleep 5 + + exit $OK + ;; + +FASTBOOT) + echo + c_info "Flashing [$KERNEL_IMAGE] on KERNEL partition..." + $FASTBOOT flash kernel ${ARTIFACTS_PATH}/${KERNEL_IMAGE} + ERROR=$? + [ $ERROR -eq 0 ] || exit -$ERROR + + echo + c_info "Flashing [$ANDROID_DTBO_IMAGE] on DTBO partition..." + $FASTBOOT flash dtbo ${ARTIFACTS_PATH}/${ANDROID_DTBO_IMAGE} + ERROR=$? + [ $ERROR -eq 0 ] || exit -$ERROR + + exit $OK + ;; + +esac + +exit -$EINVAL + diff --git a/tools/wltests/test_series b/tools/wltests/test_series index 8726c6ca75799d4136eb06ecb40084f645b62493..ef99ee5eb98e99415210ab25b7a3c43b08107893 100755 --- a/tools/wltests/test_series +++ b/tools/wltests/test_series @@ -492,6 +492,21 @@ device_not_in_adb() { return $EAGAIN } +################################################################################ +# Utility Android commands +################################################################################ +device_wake() { + device_in_adb || return $EAGAIN + $ADB shell input keyevent KEYCODE_MENU + sleep 3 + $ADB shell input keyevent KEYCODE_MENU + return $OK +} +device_not_wake() { + device_wake || return $OK + return $EAGAIN +} + ################################################################################ # DEVICE connection checks ################################################################################ @@ -556,9 +571,9 @@ boot_not_completed() { ################################################################################ -# FASTBOOT mode +# Reboot into different modes ################################################################################ -reboot_fastboot() { +enter_fastboot() { seconds=$1 # Check device is connected @@ -575,7 +590,7 @@ reboot_fastboot() { c_info "Device in ADB mode" c_info "Rebooting into bootloader..." - $ADB reboot bootloader + [ $DRYRUN -eq 1 ] || $ADB reboot bootloader echo c_info "Waiting for bootloader up to $REBOOT_TIMEOUT[s]..." @@ -608,9 +623,106 @@ reboot_fastboot() { exit $EIO fi + # Ensure we are in FASTBOOT mode, otheriwse we have to try again... + [ $DRYRUN -eq 0 ] || return $OK + device_in_fastboot || return $EAGAIN + + return $OK +} + +reboot_fastboot() { + echo + c_info "Rebooting device into FASTBOOT..." + attempts=3 + enter_fastboot; RESULT=$? + while [[ $RESULT -ne OK ]]; do + let attempts-- + if [[ $attempts -eq 0 ]]; then + c_error "device not entering FASTBOOT mode" + exit $EIO + fi + c_warning "Failed entering FASTBOOT mode, $attempts remaining attempts..." + enter_fastboot; RESULT=$? + done +} + +################################################################################ +# ADB mode +################################################################################ +enter_adb() { + + [ $DRYRUN -eq 0 ] || return $OK + + # Check device is connected + if device_not_connected; then + c_error "device not connected" + return $ENODEV + fi + + # Already in adb mode: nothing to do + if device_in_adb; then + c_info "Device already in adb mode, continuing..." + return $OK + fi + + echo + c_info "Device in FASTBOOT mode" + c_info "Booting device..." + [ $DRYRUN -eq 1 ] || $FASTBOOT reboot + + c_info "Waiting up to $REBOOT_TIMEOUT[s] for boot to complete..." + ELAPSED=0 + + #### Wait for device to reboot + [ $DRYRUN -eq 1 ] || \ + until device_in_adb || reboot_timedout; do + usb_disconnect &>/dev/null + sleep 3; let ELAPSED+=3 + usb_connect &>/dev/null + done + echo + if reboot_timedout; then + c_error "device not entering ADB mode" + d_notify "Device reboot TIMEOUT!" face-embarrassed + exit $EIO + fi + c_info "Device in ADB mode" + + ### Wait for boot to complete + [ $DRYRUN -eq 1 ] || \ + until boot_completed || reboot_timedout; do + sleep 3; let ELAPSED+=3 + done + echo + if reboot_timedout; then + c_error "device still booting?!?" + d_notify "Device boot completion TIMEOUT!" face-embarrassed + exit $EIO + fi + + # Ensure we are in ADB mode, otheriwse we have to try again... + [ $DRYRUN -eq 0 ] || return $OK + device_in_adb || return $EAGAIN + return $OK } +reboot_adb() { + echo + c_info "Rebooting device into ADB..." + attempts=3 + enter_adb; RESULT=$? + while [[ $RESULT -ne $OK ]]; do + let attempts-- + if [[ $attempts -eq 0 ]]; then + c_error "device not entering ADB mode" + exit $EIO + fi + c_warning "Failed entering ADB mode, $attempts remaining attempts..." + enter_adb; RESULT=$? + done +} + ################################################################################ # Build and test a specified SHA1 checkout ################################################################################ @@ -690,64 +802,28 @@ flash_sha1() { build_sha1 "$COMMIT_SHA1" "$COMMIT_DESC"; RESULT=$? [ $RESULT -eq $OK ] || return $RESULT - ### Reboot device into BOOTLOADER - echo - c_info "Rebooting device into bootloader..." - attempts=3 - [ $DRYRUN -eq 1 ] || reboot_fastboot - [ $DRYRUN -eq 1 ] || \ - while [[ $? -eq $ERROR ]]; do - let attempts-- - if [[ $attempts -eq 0 ]]; then - c_error "device not entering FASTBOOT mode" - exit $EIO - fi - c_warning "Failed entering FASTBOOT mode, $attempts remaining attempts..." - reboot_fastboot - done - ### Flash generated IMAGES + [ $DRYRUN -eq 0 ] || return $OK pushd $PLATFORM_PATH/artifacts &>/dev/null - [ $DRYRUN -eq 1 ] || $PLATFORM_PATH/flash_images - RESULT=$? - popd &>/dev/null - [ $RESULT -eq $OK ] || return $RESULT - - ### Reboot into new kernel - echo - c_info "Reboot new kernel..." - d_notify "Rebooting device..." face-monkey - [ $DRYRUN -eq 1 ] || $FASTBOOT reboot - - c_info "Waiting up to $REBOOT_TIMEOUT[s] for boot to complete..." - ELAPSED=0 - #### Wait for device to reboot + # Before: flash images in ADB (e.g. push new modules) + c_info "Flash images from ADB mode..." + reboot_adb [ $DRYRUN -eq 1 ] || \ - until device_in_adb || reboot_timedout; do - usb_disconnect &>/dev/null - sleep 3; let ELAPSED+=3 - usb_connect &>/dev/null - done - echo - if reboot_timedout; then - c_error "device not entering ADB mode" - d_notify "Device reboot TIMEOUT!" face-embarrassed - exit $EIO - fi - c_info "Device in ADB mode" + $PLATFORM_PATH/flash_images ADB; RESULT=$? + [ $RESULT -eq $OK ] || return $RESULT - ### Wait for boot to complete + # Then: flash images in FASTBOOT mode (e.g. kernel and dtbo images) + c_info "Flash images from FASTBOOT mode..." + reboot_fastboot [ $DRYRUN -eq 1 ] || \ - until boot_completed || reboot_timedout; do - sleep 3; let ELAPSED+=3 - done - echo - if reboot_timedout; then - c_error "device still booting?!?" - d_notify "Device boot completion TIMEOUT!" face-embarrassed - exit $EIO - fi + $PLATFORM_PATH/flash_images FASTBOOT; RESULT=$? + [ $RESULT -eq $OK ] || return $RESULT + + # Flashing completed, check for success... + popd &>/dev/null + reboot_adb + c_info "Boot completed, wait 10[s] more..." sleep 10 # Add an additional safe margin @@ -775,8 +851,9 @@ test_sha1() { match_sha1 $COMMIT_SHA1 if [ $? -ne $OK ]; then c_info "Kernel update required!" - flash_sha1 $COMMIT_SHA1 "$COMMIT_DESC" - if [[ $? -ne 0 ]]; then + flash_sha1 $COMMIT_SHA1 "$COMMIT_DESC"; RESULT=$? + [[ $RESULT -ne $EIO ]] || exit $EIO + if [[ $RESULT -ne 0 ]]; then c_warning "Skipping kernel [$COMMIT_DESC]" return fi @@ -784,8 +861,9 @@ test_sha1() { else c_warning "Device not connected via ADB, cannot check current kernel" c_warning "Forcing: build, flashing and reboot selected kernel" - flash_sha1 $COMMIT_SHA1 "$COMMIT_DESC" - if [[ $? -ne 0 ]]; then + flash_sha1 $COMMIT_SHA1 "$COMMIT_DESC"; RESULT=$? + [[ $RESULT -ne $EIO ]] || exit $EIO + if [[ $RESULT -ne 0 ]]; then c_warning "Skipping kernel [$COMMIT_DESC]" d_notify "Skipping kernel [$COMMIT_DESC]" face-sick return @@ -793,6 +871,15 @@ test_sha1() { fi echo + + c_info "Wakeup the device" + if device_not_wake; then + c_warning "Device not awake, cannot test current kernel" + c_warning "Skipping kernel [$COMMIT_DESC]" + d_notify "Skipping kernel [$COMMIT_DESC]" face-sick + return + fi + c_info "Running tests for [$COMMIT_SHA1: $COMMIT_NAME]..." d_notify "Testing kernel $COMMIT_ID/$COMMITS_COUNT:\n$COMMIT_SHA1: $COMMIT_NAME..." face-tired [ $DRYRUN -eq 1 ] || (set -x; eval $TEST_CMD; set +x) diff --git a/tools/workload-automation b/tools/workload-automation index f9df5195b966366e367725f89ab4234120e3094a..b0262e5103488648c4a5b20cddb42fa2b52104ad 160000 --- a/tools/workload-automation +++ b/tools/workload-automation @@ -1 +1 @@ -Subproject commit f9df5195b966366e367725f89ab4234120e3094a +Subproject commit b0262e5103488648c4a5b20cddb42fa2b52104ad