From nobody Tue Feb 10 03:39:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1558608673; cv=none; d=zoho.com; s=zohoarc; b=YRoOp4GI2RHTicSCwD17NV+EhpvzzIDkc0LzGFB3SWLTx9VmmpvTpyHx4BA4ix1SZeJLUspmVpUNRbwtEaBSRsmpRLRjEsCeP6lo+Qp5TABW5Qzv/wYi5ZqaBtSpy6TIQe9t5Kbe6ypPnzQlH8NyR7HhEJj2tJAftKeVy9tJ6s0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558608673; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=51qhdwAV6xax9lXPuidlfodA4doIzJZloRA4iy8CUcw=; b=nKNSrtrutfRa4OWAvDcutFXlhGODlr1+nN9jpboDV19XC6OEeu20ezRBx3lT45LtOj+d30v39Ij/gI8TEp5UNAPJjCPY3YpHR0o57g7wiKANaCvcuRAFdJHpRrIDI7pL2VTVI2r4pQXt//XrCsoJwmYtb90scxUfovI+ZjqfgqA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558608673716192.65384303863607; Thu, 23 May 2019 03:51:13 -0700 (PDT) Received: from localhost ([127.0.0.1]:33504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTlJL-0001Rg-Jl for importer@patchew.org; Thu, 23 May 2019 06:50:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTl2i-0004LW-Sq for qemu-devel@nongnu.org; Thu, 23 May 2019 06:33:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTl2h-0006Zt-05 for qemu-devel@nongnu.org; Thu, 23 May 2019 06:33:48 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:52367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTl2g-0006YZ-Np for qemu-devel@nongnu.org; Thu, 23 May 2019 06:33:46 -0400 Received: by mail-wm1-x32d.google.com with SMTP id y3so5270645wmm.2 for ; Thu, 23 May 2019 03:33:45 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g127sm8495576wme.21.2019.05.23.03.33.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 May 2019 03:33:42 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D23FD1FFAF; Thu, 23 May 2019 11:25:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=51qhdwAV6xax9lXPuidlfodA4doIzJZloRA4iy8CUcw=; b=xv9Q4JLkl3F+FEBn90oSI9NE0WaX9WV6XE025Kfxl2mX6T/+pcieNKO/yw65r2i+Gv kNyd/ul3WmFUKvCOFyBPfybkhRMGOQ003KFCCq5rMqoj2kfm3OocydZ1C5cICwV3GxSk YlLc4Ecq9VpaKX0/gtvf0e3retRGwWxQIUyolUVmybUBJb+xX0gR+g2n/Bok/1e6BDzq Ch8xK8cMpXwON20lP92id1mgvNN4oVlX+3fc7w7+8/SlbqyxXllarbxttqL+9Mw2PW+M Qku2Jj7myqra+z7Tzmsld0Mf6PMt4lWjEqWuuWm0Nt1ml5x0Bj31miuiPISbb7pHC8Qp 9yDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=51qhdwAV6xax9lXPuidlfodA4doIzJZloRA4iy8CUcw=; b=TAq3Isi0KfimdJHBB/DCnxaElwYIVh5uYUcSHotjnsFc31AOkLKvHs/5e+1HaVBVda 3rkzJSHfgVsYSwEwEyk4Rlub5FqITchIrdY6Pst/hmuwPzPrPt5yQgfPV9D0mhY+b8ED R6M0RYAxmtu+IVDjM5beMPmwqNvZC4J2uHbNoNqruAff5vpCoKMuTmF3gHXYW6dS7QWy uXpDI7XwmR0YWyiQ2jVMTPd/U43rozlNDZ0WzcLQSy5YDBpmvBTALwzj8symtyvKdxOp YFnzMpRJy5ToMSJekqX+FEmUgUKix1pNS+0g5sinS7P/zVgeYgAtamWqwK9GMpBd5syP 2YGA== X-Gm-Message-State: APjAAAXnmUFxX9sPCA+SzixmPLELnBM6Fh0+vZ1oRJldemvUWxRH3nG0 +79fxo/J6wHQbTVED/8dPwrGGw== X-Google-Smtp-Source: APXvYqxjcFj0cjiuvNcojhU8PRJofuiR45BO7Ig5DNWgibpulR0ta88i8bG5oKi86Ci+HnCSSXgqOw== X-Received: by 2002:a1c:f916:: with SMTP id x22mr10550301wmh.81.1558607624059; Thu, 23 May 2019 03:33:44 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 11:25:31 +0100 Message-Id: <20190523102532.10486-28-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523102532.10486-1-alex.bennee@linaro.org> References: <20190523102532.10486-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d Subject: [Qemu-devel] [PATCH v2 27/28] tests/qemu-iotests: re-format output to for make check-block X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , "open list:Block layer core" , Max Reitz , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This attempts to clean-up the output to better match the output of the rest of the QEMU check system when called with -makecheck. This includes: - formatting as " TEST iotest-FMT: nnn" - only dumping config on failure (when -makecheck enabled) The non-make check output has been cleaned up as well: - line re-displayed (\r) at the end - fancy colours for pass/fail/skip - timestamps always printed (option removed) Signed-off-by: Alex Benn=C3=A9e Message-Id: <20190503143904.31211-1-alex.bennee@linaro.org> Tested-by: Thomas Huth --- v3 - revert echo to printf - add _report_test_start v4 - -pretty -> -makecheck - keep all output together for makecheck v5 - merged in kwolf's pretty printing - timestamps always printed in non-makecheck mode --- tests/qemu-iotests/check | 179 +++++++++++++++++++++++++-------------- 1 file changed, 116 insertions(+), 63 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 922c5d1d3d3..f46b90dbbf4 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -27,9 +27,7 @@ bad=3D"" notrun=3D"" casenotrun=3D"" interrupt=3Dtrue - -# by default don't output timestamps -timestamp=3D${TIMESTAMP:=3Dfalse} +makecheck=3Dfalse =20 _init_error() { @@ -88,6 +86,22 @@ _full_platform_details() echo "$os/$platform $host $kernel" } =20 +_full_env_details() +{ + cat </dev/null 2>&1 && diff=3Dxxdiff fi ;; - + -makecheck) # makecheck friendly output + makecheck=3Dtrue + xpand=3Dfalse + ;; -n) # show me, don't do it showme=3Dtrue xpand=3Dfalse @@ -416,11 +433,6 @@ testlist options cachemode=3Dtrue xpand=3Dfalse ;; - -T) # turn on timestamp output - timestamp=3Dtrue - xpand=3Dfalse - ;; - -v) verbose=3Dtrue xpand=3Dfalse @@ -633,12 +645,6 @@ _wallclock() date "+%H %M %S" | awk '{ print $1*3600 + $2*60 + $3 }' } =20 -_timestamp() -{ - now=3D$(date "+%T") - printf %s " [$now]" -} - _wrapup() { if $showme @@ -704,23 +710,54 @@ END { if (NR > 0) { =20 trap "_wrapup; exit \$status" 0 1 2 3 15 =20 +# Report the test start and results. For makecheck we want to pretty +# print the whole report at the end of the execution. +# args: $seq, $starttime, $lasttime +_report_test_start() +{ + if ! $makecheck; then + if [ -n "$3" ]; then + local lasttime=3D" (last: $3s)" + fi + printf "%-8s %-10s [%s] %4s%-14s\r" "$1" "..." "$2" "..= ." "$lasttime" + fi +} +# args:$seq $status $starttime $lasttime $thistime $details +_report_test_result() +{ + local status lasttime thistime + if $makecheck; then + if [ -n "$2" ] && [ "$2" !=3D "pass" ]; then + status=3D" [$2]" + fi + printf " TEST iotest-$IMGFMT: %s%s\n" "$1" "$status" + return + fi + + if [ -n "$4" ]; then + lasttime=3D" (last: $4s)" + fi + if [ -n "$5" ]; then + thistime=3D" $5s" + fi + case "$2" in + "pass") status=3D$(printf "\e[32m%-10s\e[0m" "$2") ;; + "fail") status=3D$(printf "\e[1m\e[31m%-10s\e[0m" "$2") ;; + "not run") status=3D$(printf "\e[33m%-10s\e[0m" "$2") ;; + *) status=3D$(printf "%-10s" "$2") ;; + esac + + printf "%-8s %s [%s] [%s] %4s%-14s %s\n" "$1" "$status" "$3" "$(date '= +%T')" "$thistime" "$lasttime" "$6" +} + [ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE =20 FULL_IMGFMT_DETAILS=3D$(_full_imgfmt_details) FULL_HOST_DETAILS=3D$(_full_platform_details) =20 -cat <= $TESTS_REMAINING_LOG.tmp mv $TESTS_REMAINING_LOG.tmp $TESTS_REMAINING_LOG sync fi =20 + lasttime=3D$(sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE) + starttime=3D$(date "+%T") + _report_test_start $seq $starttime $lasttime + if $showme then - echo - continue + status=3D"not run" elif [ -f expunged ] && $expunge && egrep "^$seq([ ]|\$)" expu= nged >/dev/null then - echo " - expunged" + status=3D"not run" + results=3D"expunged" rm -f $seq.out.bad echo "/^$seq\$/d" >>$tmp.expunged elif [ ! -f "$source_iotests/$seq" ] then - echo " - no such test?" + status=3D"not run" + results=3D"no such test?" echo "/^$seq\$/d" >>$tmp.expunged else # really going to try and run this one # rm -f $seq.out.bad - lasttime=3D$(sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE) - if [ "X$lasttime" !=3D X ]; then - printf %s " ${lasttime}s ..." - else - printf " " # prettier output with timestamps. - fi rm -f core $seq.notrun rm -f $seq.casenotrun =20 start=3D$(_wallclock) - $timestamp && printf %s " [$(date "+%T")]" =20 if [ "$(head -n 1 "$source_iotests/$seq")" =3D=3D "#!/usr/bin/env = python" ]; then run_command=3D"$PYTHON $seq" @@ -781,26 +819,26 @@ do $run_command >$tmp.out 2>&1) fi sts=3D$? - $timestamp && _timestamp stop=3D$(_wallclock) =20 if [ -f core ] then - printf " [dumped core]" mv core $seq.core + status=3D"fail" + results=3D"[dumped core] $seq.core" err=3Dtrue fi =20 if [ -f $seq.notrun ] then - $timestamp || printf " [not run] " - $timestamp && echo " [not run]" && printf %s " $seq -- " - cat $seq.notrun - notrun=3D"$notrun $seq" + # overwrites timestamp output + status=3D"not run" + results=3D"$(cat $seq.notrun)" else if [ $sts -ne 0 ] then - printf %s " [failed, exit status $sts]" + status=3D"fail" + results=3D$(printf %s "[failed, exit status $sts]") err=3Dtrue fi =20 @@ -821,22 +859,23 @@ do =20 if [ ! -f "$reference" ] then - echo " - no qualified output" + status=3D"fail" + reason=3D"no qualified output" err=3Dtrue else if diff -w "$reference" $tmp.out >/dev/null 2>&1 then - echo "" - if $err - then - : - else - echo "$seq $(expr $stop - $start)" >>$tmp.time + if ! $err; then + status=3D"pass" + thistime=3D$(expr $stop - $start) + echo "$seq $thistime" >>$tmp.time fi else - echo " - output mismatch (see $seq.out.bad)" mv $tmp.out $seq.out.bad $diff -w "$reference" "$PWD"/$seq.out.bad + status=3D"fail" + results=3D"output mismatch (see $seq.out.bad)" + printdiff=3Dtrue err=3Dtrue fi fi @@ -850,13 +889,27 @@ do =20 # come here for each test, except when $showme is true # - if $err - then - bad=3D"$bad $seq" - n_bad=3D$(expr $n_bad + 1) - quick=3Dfalse - fi - [ -f $seq.notrun ] || try=3D$(expr $try + 1) + _report_test_result $seq "$status" "$starttime" "$lasttime" "$thistime= " "$results" + case "$status" in + "pass") + try=3D$(expr $try + 1) + ;; + "fail") + try=3D$(expr $try + 1) + if $makecheck; then + _full_env_details + fi + if $printdiff; then + $diff -w "$reference" "$PWD"/$seq.out.bad + fi + bad=3D"$bad $seq" + n_bad=3D$(expr $n_bad + 1) + quick=3Dfalse + ;; + "not run") + notrun=3D"$notrun $seq" + ;; + esac =20 seq=3D"after_$seq" done --=20 2.20.1