From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6550672687897772032 X-Received: by 2002:adf:a114:: with SMTP id o20-v6mr1266252wro.11.1525197338267; Tue, 01 May 2018 10:55:38 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.247.7 with SMTP id v7ls926112wmh.1.canary-gmail; Tue, 01 May 2018 10:55:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrYJbGX+0Nk9Xc1HCJsbDOnr0k445owH0IzKwTvT+KvzD3/9aWoiGfzy2s4/4o/qC4wB/Qd X-Received: by 10.28.52.79 with SMTP id b76mr1397397wma.12.1525197337544; Tue, 01 May 2018 10:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525197337; cv=none; d=google.com; s=arc-20160816; b=eh77zTf1XchShDWEjoNSfnrQyztjgEyhESNCyJ1w4fhdrxeHrP84etWCe0WYiK7y3b J+dgsrJNYF1rmaMFsgN/ISdyUvmgRayRIeqxXlTHP7Tiz/6OksacqxCj5wBwmNmFGa5y E/tOT1dF+l45GOhYTsmZ5oMDDTtuhHxAdNIFQfBXl4wuZpUd+r7AlSj8CmJMEbIitKij k9JLC4ux8Ph9p63yYd1ZPdH48bVYZQ9eMHujz7J1VailR08UyJ5HBfnm0GV+4ngzIpVT dvQEC0pqMZDMAozaD09UPlRTh5C0JYtCKjGMQ4w617xsjjzOGMuESakqxVGCnEnV5vtM KUQQ== 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 :arc-authentication-results; bh=tDcI8sL0kjWQUkr+dMwmskEmBvZtt0y1LNmWLDl+o6M=; b=LCGCr/f7x0Nb1Mc5HRzxdVlRgYqgkNd8UWvleK/kgxOsfwIOZWtkGEqFYR+q60Z+Jz jNOyTPEWJyzd370j74IAn1vIFc0q813vYMTpVvLUD0FAFxU/3ss8jso7ku1D05fa6l85 CotqRbHKrRaB0Y1wK/mf1ehkRiPNn+tn7wUN8iDjOkgM+oEtzpQkdPsLR5Djghay5Ezr UF59OQzt8erspgHub6Gv5OMbgK/aXblECHnpzqmdxOpzB+Jv+uw0CIv6pGz7CvA92ZAd bWyTTM70+Vr3+ix3OeoCXhD1wUbfkTlWekrILHNFIXNRZ/ffi8IqP3ieC2NeFJ+gQzj3 y9fA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id e80si285841wmd.2.2018.05.01.10.55.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 May 2018 10:55:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Received: from localhost.localdomain ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id w41HtMBi019597 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 1 May 2018 19:55:29 +0200 From: Alexander Smirnov To: isar-users@googlegroups.com Cc: Alexander Smirnov Subject: [PATCH 1/3] scripts/vm_smoke_test: Add verbosity parameter Date: Tue, 1 May 2018 20:55:09 +0300 Message-Id: <20180501175511.26145-2-asmirnov@ilbers.de> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180501175511.26145-1-asmirnov@ilbers.de> References: <20180501175511.26145-1-asmirnov@ilbers.de> X-TUID: hB+g7MslFs9N Issues: 1. Currently this script displays boot log for all the images. This could bring some inconviniences for users, who want to perform quick test and get just messages FAILED/PASSED. 2. Also the boot log is displayed if test case failed. So in the worst case when all cases for current image failed, the boot log will be displayed 3 times. Solution: 1. If at least one test case failed for current image, the boot log will be displayed (only one time, despite on number of cases failed). 2. Boot log is disabled by default. It could be enabled for all the images by '-v' option passed to this script. Signed-off-by: Alexander Smirnov --- scripts/vm_smoke_test | 62 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test index 274ec1d..92fda2d 100755 --- a/scripts/vm_smoke_test +++ b/scripts/vm_smoke_test @@ -5,13 +5,19 @@ CONSOLE_OUTPUT=/tmp/isar_console PID_FILE=/tmp/qemu.pid +VERBOSE=0 -RET=0 +# Error codes: +ES_OK=0 +ES_FAIL=1 +ES_BUG=3 + +RET=$ES_OK dump_boot_log() { - echo "Boot log: 8<--" + echo "Boot log:\n8<--" cat $CONSOLE_OUTPUT - echo -e "\n8<--" + echo "\n8<--" } check_login_prompt() { @@ -23,8 +29,8 @@ check_login_prompt() { echo "PASSED" else echo "FAIL" - dump_boot_log - RET=1 + RET=$ES_FAIL + FAIL=1 fi } @@ -37,8 +43,8 @@ check_example_module() { echo "PASSED" else echo "FAIL" - dump_boot_log - RET=1 + RET=$ES_FAIL + FAIL=1 fi } @@ -54,19 +60,59 @@ run_test () { sleep 60 kill `cat $PID_FILE` + FAIL=0 + # Check login prompt check_login_prompt # Check kernel module check_example_module - dump_boot_log + [ $VERBOSE -eq 1 -o $FAIL -eq 1 ] && dump_boot_log # Clean up test artifacts rm $CONSOLE_OUTPUT rm $PID_FILE } +show_help() { + echo "This script tests all the default Isar images in QEMU." + echo + echo "Usage:" + echo " $0 [params]" + echo + echo "Parameters:" + echo " -v, --verbose display boot logs for all the targets." + echo " -h, --help display this message and exit." + echo + echo "Exit status:" + echo " 0 if OK," + echo " 1 if test failed," + echo " 3 if invalid parameters are passed." +} + +# Parse command line to get user configuration +while [ $# -gt 0 ] +do + key="$1" + + case $key in + -h|--help) + show_help + exit 0 + ;; + -v|--verbose) + VERBOSE=1 + ;; + *) + echo "error: invalid parameter '$key', please try '--help' to get list of supported parameters" + exit $ES_BUG + ;; + esac + + shift +done + # ARM machine run_test arm wheezy run_test arm jessie -- 2.1.4