From: Anton Mikanovich <anton.mikanovich@promwad.com>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH v14 16/16] vm_smoke_test: Migrate to Avocado
Date: Thu, 30 Sep 2021 19:45:41 +0300 [thread overview]
Message-ID: <1633020341-26062-17-git-send-email-anton.mikanovich@promwad.com> (raw)
In-Reply-To: <1633020341-26062-1-git-send-email-anton.mikanovich@promwad.com>
From: Anton Mikanovich <amikan@ilbers.de>
Call Avocado test cases instead of shell based.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
scripts/vm_smoke_test | 120 ++++++++++++--------------------------------------
1 file changed, 28 insertions(+), 92 deletions(-)
diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test
index ce08213..6416250 100755
--- a/scripts/vm_smoke_test
+++ b/scripts/vm_smoke_test
@@ -3,9 +3,7 @@
# This software is a part of ISAR.
# Copyright (C) 2015-2018 ilbers GmbH
-CONSOLE_OUTPUT=/tmp/isar_console
-PID_FILE=/tmp/qemu.pid
-VERBOSE=1
+VERBOSE="--show=test"
TIMEOUT=300
# Error codes:
@@ -13,75 +11,15 @@ ES_OK=0
ES_FAIL=1
ES_BUG=3
-RET=$ES_OK
+RET=$ES_FAIL
-dump_boot_log() {
- echo "Boot log:\n8<--"
- cat $CONSOLE_OUTPUT
- echo "\n8<--"
-}
-
-check_login_prompt() {
- echo -n "Check login prompt: "
-
- str=$(grep "isar login: " $CONSOLE_OUTPUT)
-
- if [ -n "$str" ]; then
- echo "PASSED"
- else
- echo "FAIL"
- RET=$ES_FAIL
- FAIL=1
- fi
-}
-
-check_example_module() {
- echo -n "Check example module: "
-
- str=$(grep "Just an example" $CONSOLE_OUTPUT)
-
- if [ -n "$str" ]; then
- echo "PASSED"
- else
- echo "FAIL"
- RET=$ES_FAIL
- FAIL=1
- fi
-}
-
-run_test () {
- ARCH=$1
- DISTRO=$2
+# Get Avocado QEMU tests path
+VM_TEST_DIR="$(dirname "$0")/../testsuite/vm_boot_test"
- echo "-------------------------------------------------"
- echo "Testing Isar [$DISTRO] image for [$ARCH] machine:"
+# Go to Isar root
+cd "$(dirname "$0")/.."
- start_vm -a $ARCH -d $DISTRO -o $CONSOLE_OUTPUT -p $PID_FILE > /dev/null 2>&1 &
- sleep 5
-
- if [ -z `ps -p $! -o pid=` ]; then
- echo "QEMU start: FAILED"
- RET=$ES_FAIL
- echo "Command output:\n8<--"
- start_vm -a $ARCH -d $DISTRO -o $CONSOLE_OUTPUT -p $PID_FILE
- echo "\n8<--"
- else
- sleep $TIMEOUT
- kill `cat $PID_FILE`
-
- FAIL=0
-
- check_login_prompt
-
- check_example_module
-
- [ $VERBOSE -eq 1 -o $FAIL -eq 1 ] && dump_boot_log
-
- rm $CONSOLE_OUTPUT
- fi
-
- rm $PID_FILE
-}
+BUILD_DIR=./build
show_help() {
echo "This script tests the Isar images for default targets in QEMU."
@@ -91,10 +29,6 @@ show_help() {
echo
echo "Parameters:"
echo " -f,--fast test reduced set of supported targets."
- echo " -o,--output FILE specify file to store console output."
- echo " The default is: /tmp/isar_console"
- echo " -p,--pid-file FILE specify file to store QEMU process PID."
- echo " The default is: /tmp/qemu.pid"
echo " -q, --quiet do not display boot logs for all the targets."
echo " If test failed for the specific configuration,"
echo " the respective boot log will be printed anyway."
@@ -119,18 +53,18 @@ do
exit 0
;;
-o|--output)
- CONSOLE_OUTPUT=$2
+ # Deprecated option
shift
;;
-p|--pid-file)
- PID_FILE=$2
+ # Deprecated option
shift
;;
-f|--fast)
FAST_BUILD="1"
;;
-q|--quiet)
- VERBOSE=0
+ VERBOSE=""
;;
-t|--timeout)
TIMEOUT=$2
@@ -145,24 +79,26 @@ do
shift
done
-# ARM machine
-run_test arm stretch
-run_test arm buster
-
-# AMD64 machine
-if [ -z "$FAST_BUILD" ]; then
- run_test amd64 buster
- run_test amd64 focal
+TAGS="full"
+if [ -n "$FAST_BUILD" ]; then
+ TAGS="fast"
fi
-run_test amd64 stretch
-# i386 machine
-if [ -z "$FAST_BUILD" ]; then
- run_test i386 stretch
- run_test i386 buster
+# Provide working path
+mkdir -p .config/avocado
+cat <<EOF > .config/avocado/avocado.conf
+[datadir.paths]
+base_dir = $BUILD_DIR/
+test_dir = $BUILD_DIR/tests
+data_dir = $BUILD_DIR/data
+logs_dir = $BUILD_DIR/job-results
+EOF
+export VIRTUAL_ENV="./"
+
+if avocado $VERBOSE run "$VM_TEST_DIR/vm_boot_test.py" -t $TAGS \
+ --test-runner=runner --disable-sysinfo \
+ -p build_dir="$BUILD_DIR" -p time_to_wait=$TIMEOUT; then
+ RET=$ES_OK
fi
-# ARM64 machine
-run_test arm64 stretch
-
exit $RET
--
2.7.4
next prev parent reply other threads:[~2021-09-30 16:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 16:45 [PATCH v14 00/16] Update Avocado testsuite Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 01/16] start_vm.py: Fix target name handling Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 02/16] start_vm.py: Add output and PID file vm_start.py options Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 03/16] start_vm.py: Add MIPS support Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 04/16] start_vm.py: Fix ubuntu image name Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 05/16] vm_boot_test: Fix log file path in vm_boot_test Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 06/16] vm_boot_test: Remove external varianter Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 07/16] vm_boot_test: Improve QEMU images checking Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 08/16] build_test: Refactoring build tests cases Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 09/16] testsuite: Add Python generations for testsuite in gitignore Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 10/16] testsuite: Fix test suite prepare guide Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 11/16] gitlab-ci: Add Avocado build artifacts Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 12/16] gitlab-ci: Add debug flag Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 13/16] vm_boot_test: Add automatic bitbake init Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 14/16] build_test: Protect ubuntu target with KFAIL Anton Mikanovich
2021-09-30 16:45 ` [PATCH v14 15/16] ci_build: Migrate to Avocado Anton Mikanovich
2021-09-30 16:45 ` Anton Mikanovich [this message]
2021-10-14 8:54 ` [PATCH v14 00/16] Update Avocado testsuite Jan Kiszka
2021-10-14 10:25 ` Baurzhan Ismagulov
2021-10-14 15:51 ` Jan Kiszka
2021-10-19 8:34 ` Schmidt, Adriaan
2021-10-22 6:54 ` Anton Mikanovich
2021-10-19 9:54 ` Henning Schild
2021-10-21 9:48 ` Baurzhan Ismagulov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1633020341-26062-17-git-send-email-anton.mikanovich@promwad.com \
--to=anton.mikanovich@promwad.com \
--cc=amikan@ilbers.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox