From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6550672688539500544 X-Received: by 2002:a17:902:8bca:: with SMTP id r10-v6mr6036480plo.39.1525436860323; Fri, 04 May 2018 05:27:40 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a65:5c8d:: with SMTP id a13-v6ls2469299pgt.5.gmail; Fri, 04 May 2018 05:27:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqdWBHchq/LTokItw/V+jE3ESGNzZOSdg5aMP60OGUhbEM2KTIqJomRtRV0D0cu6KUWaCdn X-Received: by 10.98.227.7 with SMTP id g7mr6077535pfh.48.1525436859865; Fri, 04 May 2018 05:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525436859; cv=none; d=google.com; s=arc-20160816; b=MUV1eWDUY8/+tKlkcIa94I1cFnqlIrxbKnrJbm8X/Shy6K1xXtW9TE/Z4rQRFzy+H6 XTPKe1wHD3VlpY3GMPMgGEbvElCLFJUcGBP1gTkGLspZF/uAtmhN8jllyxOFExXj+hp6 fB7tl8XBiYSKp1aF5LhmlZEO2ESZ/Mf598gHsYjmOlkwxORa6EVF3gPq5uOrwXSlFUde 72LBInytM5AWSIT3XNKMrYdeDGfBogYgvNspvQ1ngOPbb81ABxPPni7ufeaEocNu9el1 rsuPQbCvU12ZEfL1r2Br7roCBusUPQSRZev9nwo2JFiC59ahwxalKIh6WE8VBweHqfYi cwzQ== 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=oVEF/0o2hSFiz39W4zjzbKQ0z8Zj7JpLlwCeGqNhlyA=; b=Vbvd50kblqQNpzi4mrzkFEOFn0LD2v34akju6txR9DTeV363LWSDuhiOsBfBOMTaMB R7BCMpKfn0e5g3/Lp+9QYeNJteq1kQEE0y47vO0l1rkOggHKGuaZef9t7fIKSJrcMC+R uZXZMpJV/Cejr5V2p5w65r5cwg3DZgxz07W9YBESNUIHQamqD19+zxj1A37RFB92KbpJ OUF83+FJL6/cdj8MYrShJUOlRFlGS3zgfYAihathLZAFl5sXbHL3NpHWOW72JJ3KrPHg u3tvQVScbXbnOWR0TC3JVj1ky2z1X70VlUvc7T1MZr/tTJDMBdBJRJWXu5GFY+CI33Eg GQ6A== 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 63-v6si766623pgg.0.2018.05.04.05.27.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 May 2018 05:27:39 -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 w44CRLEC030799 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 4 May 2018 14:27:27 +0200 From: Alexander Smirnov To: isar-users@googlegroups.com Cc: Alexander Smirnov Subject: [PATCH v2 1/3] scripts/vm_smoke_test: Add quite parameter Date: Fri, 4 May 2018 15:27:12 +0300 Message-Id: <20180504122714.1201-2-asmirnov@ilbers.de> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180504122714.1201-1-asmirnov@ilbers.de> References: <20180504122714.1201-1-asmirnov@ilbers.de> X-TUID: YG03XroEuhHq Due to this script is used for QA needs only, it's OK that it has verbose output enabled by default. This patch adds option to supress excessive output. But the boot log for specific configuration will be anyway shown if respective test case failed. Also this patch fixes an issue that the same boot log could be displayed multiple times. Signed-off-by: Alexander Smirnov --- scripts/vm_smoke_test | 68 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test index 274ec1d..76db97d 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=1 -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 } @@ -49,24 +55,62 @@ run_test () { echo "-------------------------------------------------" echo "Testing Isar [$DISTRO] image for [$ARCH] machine:" - # Start QEMU with Isar image start_vm -a $ARCH -d $DISTRO -o $CONSOLE_OUTPUT -p $PID_FILE > /dev/null 2>&1 & sleep 60 kill `cat $PID_FILE` - # Check login prompt + FAIL=0 + 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 " -q, --quite 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." + 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 + ;; + -q|--quite) + VERBOSE=0 + ;; + *) + 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