From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7008446828784910336 X-Received: by 2002:a2e:b608:: with SMTP id r8mr6874909ljn.248.1633020400019; Thu, 30 Sep 2021 09:46:40 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:5d3:: with SMTP id 202ls1414864ljf.4.gmail; Thu, 30 Sep 2021 09:46:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEnv090D633ejHRKil10o6FE15aYw/j0q4DIZjAYKcERTGTw5hfohgJDFcuj9rXMljWe47 X-Received: by 2002:a2e:5702:: with SMTP id l2mr7239290ljb.370.1633020399063; Thu, 30 Sep 2021 09:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633020399; cv=none; d=google.com; s=arc-20160816; b=TA0oIe9K4NmC6oYOG2vdqWlY1yxHQ+1mKuTa1vo6EUbLIy3Pk5OKwQe0fhu5mZy+Lq izZ45nAu5/ZZMUcMv/Yvp5POh1H4SKcJcvls1QtQcGc6PjQdE3H1NZghNsdQyJnUkMZE oOFsWcYG0EURca0sHTHRF/sTn/Vjw0wHuV+KxpZAm1aBqGctYcjU/ixRnPKRwwcY69Nv WA/5RA+9Uyr0PLPeDzeUttwxgNxi+YcZT9v4CPuQ5tOc9R/WOA3CFZVR4oiSFdOlDhot 5xAHgg5xeW5gPbjB8Ka2I5IivVRa7irCxYD8qmVoSnepBJCT0ECvfZaI9TYmd+0TZi4G Z0wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZyADTuGX9quoqAvHprzhnHXV99ktPLQnKpWXWs0cJpQ=; b=Cp0I1uSJpwyM65xaHQQg/sHRF0ZUsjbvr1bzpcQ2bFFrEhGeQALxRYsBZ3GZb0/E+S V0okEPvWMrAtbXl/OyJ4vUXieyWPv+U2lAtIsgPIaEuH7RSp+j/F7A7aE5etTbVUP7Jv Af30cYw9KSMOnh5kCIOItfMlqRqb0pIr2PQaoNT/aAcqa3BjShHs54njExt4pw1znO8A ymH3ldMSj0Bjt20MK8zlSA7ue0xHD2I3OkIQO9BJ/83Ih7D3ogYWlaou4Zy5gZ//4OAU aSc2FE42jwCwEwG09H6d+dpPBkORU63Aapt8b+88WkgVbp5PUu6LHS/w09KQgRPbq3Py o5JA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=softfail (google.com: domain of transitioning anton.mikanovich@promwad.com does not designate 85.214.156.166 as permitted sender) smtp.mailfrom=anton.mikanovich@promwad.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=promwad.com Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id q13si79013ljg.7.2021.09.30.09.46.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Sep 2021 09:46:39 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning anton.mikanovich@promwad.com does not designate 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=softfail (google.com: domain of transitioning anton.mikanovich@promwad.com does not designate 85.214.156.166 as permitted sender) smtp.mailfrom=anton.mikanovich@promwad.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=promwad.com Received: from ws-323.promwad.corp (leased-line-st-87-252-252-30.telecom.by [87.252.252.30]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 18UGjhuo018892 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NOT); Thu, 30 Sep 2021 18:46:36 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Anton Mikanovich Subject: [PATCH v14 16/16] vm_smoke_test: Migrate to Avocado Date: Thu, 30 Sep 2021 19:45:41 +0300 Message-Id: <1633020341-26062-17-git-send-email-anton.mikanovich@promwad.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1633020341-26062-1-git-send-email-anton.mikanovich@promwad.com> References: <1633020341-26062-1-git-send-email-anton.mikanovich@promwad.com> X-TUID: cdrMsXa47fMn From: Anton Mikanovich Call Avocado test cases instead of shell based. Signed-off-by: Anton Mikanovich --- 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 < .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