From 8dc26f581a0f56075903dfce66c9de8466730e5c Mon Sep 17 00:00:00 2001 From: Milosz Wasilewski Date: Tue, 23 Jan 2024 12:32:51 +0000 Subject: [PATCH] automated: linux: add aklite-apps test Test exercises aklite-apps utility from LmP. This utility allows to run docker-compose apps without registering to FoundriesFactory. Signed-off-by: Milosz Wasilewski --- automated/linux/aklite-apps/aklite-apps.sh | 57 ++++++++++++++++++++ automated/linux/aklite-apps/aklite-apps.yaml | 27 ++++++++++ 2 files changed, 84 insertions(+) create mode 100755 automated/linux/aklite-apps/aklite-apps.sh create mode 100644 automated/linux/aklite-apps/aklite-apps.yaml diff --git a/automated/linux/aklite-apps/aklite-apps.sh b/automated/linux/aklite-apps/aklite-apps.sh new file mode 100755 index 000000000..8868d39d1 --- /dev/null +++ b/automated/linux/aklite-apps/aklite-apps.sh @@ -0,0 +1,57 @@ +#!/bin/bash -e +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) 2021 Foundries.io Ltd. + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE +APPS="" +DEFAULT_APPS="" +LOOP_APPS="" +APPS_ARG="" + +usage() { + echo "\ + Usage: $0 -a -d + + -a + Comma separated list of apps to start + -d + Comma separated list of default apps to start + Conflicts with -a + " +} + +while getopts "a:d:h" opts; do + case "$opts" in + a) APPS="${OPTARG}";; + d) DEFAULT_APPS="${OPTARG}";; + h|*) usage ; exit 1 ;; + esac +done + + +! check_root && error_msg "You need to be root to run this script." +create_out_dir "${OUTPUT}" + +if [ -n "${APPS}" ]; then + APPS_ARG=" --apps ${APPS}" + LOOP_APPS="${APPS}" +elif [ -n "${DEFAULT_APPS}" ]; then + LOOP_APPS="${DEFAULT_APPS}" +fi + +# shellcheck disable=SC2086 +aklite-apps run ${APPS_ARG} +if [ -n "${LOOP_APPS}" ]; then + IFS="," + for app in ${LOOP_APPS} + do + docker ps | grep "${app}" + check_return "${app}-running" + done +else + report-skip "aklite-apps" +fi diff --git a/automated/linux/aklite-apps/aklite-apps.yaml b/automated/linux/aklite-apps/aklite-apps.yaml new file mode 100644 index 000000000..e4e55c358 --- /dev/null +++ b/automated/linux/aklite-apps/aklite-apps.yaml @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) 2021 Foundries.io +metadata: + format: Lava-Test Test Definition 1.0 + name: aklite-apps + description: "Run apps without registration" + + maintainer: + - milosz.wasilewski@foundries.io + os: + - openembedded + scope: + - functional + + devices: + - imx8mm + - bcm2711-rpi-4-b + +params: + APPS: "" + DEFAULT_APPS: "" + +run: + steps: + - cd ./automated/linux/aklite-apps + - ./aklite-apps.sh -a "${APPS}" -d "${DEFAULT_APPS}" + - ../../utils/send-to-lava.sh ./output/result.txt