From patchwork Mon Jun 20 19:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 12888110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C546CCA480 for ; Mon, 20 Jun 2022 19:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240882AbiFTTaD (ORCPT ); Mon, 20 Jun 2022 15:30:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236396AbiFTTaC (ORCPT ); Mon, 20 Jun 2022 15:30:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B2271C121 for ; Mon, 20 Jun 2022 12:30:01 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E452E1F9DE for ; Mon, 20 Jun 2022 19:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655753399; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5b+oP1cC+XIgT34cKI1K6B4NQiAU0vxv4AAKjKmjNmo=; b=mEf1DqCXUcbIegm4ZAi1B0o1Gn92exvZDpm/3WYB+gjvJ05HWjFO9MYxx8/0u3VhR4nBNj N/iklx5Le5f3gsRBcTlIAF+Huz2SC3BRXUwtGKOQ8YXGBhpn5ZK486io7pWrlHVNxZp3ZN JU9t/z3TEKIbnXXR3g5uox18aNbgd1Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655753399; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5b+oP1cC+XIgT34cKI1K6B4NQiAU0vxv4AAKjKmjNmo=; b=CcInWHIMLAkqr/sozNq1n1w344DLXuERbcYQiU8bPOqTywK+Y/G+ujI4kNmChyP6yYqFmj aJjgE3xhX1+k4QDg== Received: from echidna.suse.de (unknown [10.163.47.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C9FE62C141; Mon, 20 Jun 2022 19:29:59 +0000 (UTC) From: David Disseldorp To: fstests@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 1/6] check: avoid FSTYP= repetition Date: Mon, 20 Jun 2022 21:29:29 +0200 Message-Id: <20220620192934.21694-2-ddiss@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220620192934.21694-1-ddiss@suse.de> References: <20220620192934.21694-1-ddiss@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Signed-off-by: David Disseldorp Reviewed-by: Zorro Lang --- check | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/check b/check index de11b37e..42925e09 100755 --- a/check +++ b/check @@ -277,15 +277,13 @@ while [ $# -gt 0 ]; do case "$1" in -\? | -h | --help) usage ;; - -nfs) FSTYP=nfs ;; - -glusterfs) FSTYP=glusterfs ;; - -cifs) FSTYP=cifs ;; - -9p) FSTYP=9p ;; - -virtiofs) FSTYP=virtiofs ;; - -overlay) FSTYP=overlay; export OVERLAY=true ;; - -pvfs2) FSTYP=pvfs2 ;; - -tmpfs) FSTYP=tmpfs ;; - -ubifs) FSTYP=ubifs ;; + -nfs|-glusterfs|-cifs|-9p|-virtiofs|-pvfs2|-tmpfs|-ubifs) + FSTYP="${1:1}" + ;; + -overlay) + FSTYP=overlay + export OVERLAY=true + ;; -g) group=$2 ; shift ; GROUP_LIST="$GROUP_LIST ${group//,/ }" From patchwork Mon Jun 20 19:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 12888111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B664CCA481 for ; Mon, 20 Jun 2022 19:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236396AbiFTTaE (ORCPT ); Mon, 20 Jun 2022 15:30:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237260AbiFTTaC (ORCPT ); Mon, 20 Jun 2022 15:30:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68C1F1C122 for ; Mon, 20 Jun 2022 12:30:01 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 112531FA14 for ; Mon, 20 Jun 2022 19:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VqWOJwJZ7adxjpdQPzHGsky4QKFFGOh8tJDz1L61VaQ=; b=j1cBrIWVv6U+VQI7Bt3QK5IhJGD+i9KPXU/a8wIG0Ay/FAmFGfwVWsNEFNiXBB8fa4uz8+ /Pc2LqoICUNVOWadUXo7xw9hXrP9UWoCUIJpQse0nbUv35jMpjr1BqiPIkPn769XZQXET7 CY+s1TxSjGQbgyyRNKJ8ZtgVyD4v7mA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VqWOJwJZ7adxjpdQPzHGsky4QKFFGOh8tJDz1L61VaQ=; b=ovk+t89zeNjElv1RKjHXyfKA4YyH/4mbreqMSMUzrtSGn8EXkIjkdBoLsiebDUEC8i90Zv V5HqeqPEj9A/5WAw== Received: from echidna.suse.de (unknown [10.163.47.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id EAE4B2C143; Mon, 20 Jun 2022 19:29:59 +0000 (UTC) From: David Disseldorp To: fstests@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 2/6] check: simplify check.time parsing Date: Mon, 20 Jun 2022 21:29:30 +0200 Message-Id: <20220620192934.21694-3-ddiss@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220620192934.21694-1-ddiss@suse.de> References: <20220620192934.21694-1-ddiss@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org There's no need to use grep and awk when the latter can do all that's needed, including the pretty printing. Signed-off-by: David Disseldorp Reviewed-by: Zorro Lang --- check | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/check b/check index 42925e09..43c072d2 100755 --- a/check +++ b/check @@ -819,13 +819,9 @@ function run_section() try="$try $seqnum" n_try=`expr $n_try + 1` - # slashes now in names, sed barfs on them so use grep - lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'` - if [ "X$lasttime" != X ]; then - echo -n " ${lasttime}s ... " - else - echo -n " " # prettier output with timestamps. - fi + awk 'BEGIN {lasttime=" "} \ + $1 == "'$seqnum'" {lasttime=" " $2 "s ... "; exit} \ + END {printf "%s", lasttime}' "$check.time" rm -f core $seqres.notrun start=`_wallclock` From patchwork Mon Jun 20 19:29:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 12888114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1D4CCCA482 for ; Mon, 20 Jun 2022 19:30:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238335AbiFTTaH (ORCPT ); Mon, 20 Jun 2022 15:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238346AbiFTTaD (ORCPT ); Mon, 20 Jun 2022 15:30:03 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 888A51C12F for ; Mon, 20 Jun 2022 12:30:01 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 3A93121990 for ; Mon, 20 Jun 2022 19:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WYh/vgmmDIfTIn20IM19bfRXaanI1p2bXSV/WQTOeaE=; b=WKg4hqlUwrQneSUbgtgTGoyTLKOXZ8+JQ6owy4ecs30BwO/Ns0f9rLTs8RKUA59vyXCxA/ QMLZxywhGmHbyBshXDJ4sdFRd17I6sYlkH0q1xwltyP7V7KwACQq2hurCtJTCzJA51yz8X PBRh6zy9X7Ty3tHZR3rj+7FPy9HZBiM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WYh/vgmmDIfTIn20IM19bfRXaanI1p2bXSV/WQTOeaE=; b=fhZOQXgSjKbqHQesHPnMDl6af4GTZ/RtQrpCWBElMaQyxMDLaXu37RHvbkRrfELRR6T08q Jk87L39d/F8ztrCg== Received: from echidna.suse.de (unknown [10.163.47.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 177E32C145; Mon, 20 Jun 2022 19:30:00 +0000 (UTC) From: David Disseldorp To: fstests@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 3/6] report: drop unused _xunit_make_section_report parameter Date: Mon, 20 Jun 2022 21:29:31 +0200 Message-Id: <20220620192934.21694-4-ddiss@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220620192934.21694-1-ddiss@suse.de> References: <20220620192934.21694-1-ddiss@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Signed-off-by: David Disseldorp Reviewed-by: Zorro Lang --- common/report | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/report b/common/report index 6cac71fc..bf05afa9 100644 --- a/common/report +++ b/common/report @@ -152,7 +152,7 @@ _make_section_report() for report in $REPORT_LIST; do case "$report" in "xunit") - _xunit_make_section_report "$test_status" + _xunit_make_section_report ;; *) _dump_err "format '$report' is not supported" From patchwork Mon Jun 20 19:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 12888116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89730C433EF for ; Mon, 20 Jun 2022 19:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237260AbiFTTaF (ORCPT ); Mon, 20 Jun 2022 15:30:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239371AbiFTTaD (ORCPT ); Mon, 20 Jun 2022 15:30:03 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABC321C130 for ; Mon, 20 Jun 2022 12:30:01 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5DE8621B2F for ; Mon, 20 Jun 2022 19:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X7hYVIN9iHd1LTjQv7uRYMcCiGgDiiOShTjqADvxK3A=; b=MOe3HP2xiiHjs+XJ/jKIMih7XmBU10LZV4NyFsaosOLZnufmOFkCiJi/XJc9IBsHZkYuXj TGbziwRgq/gnFv7dnWn3oJBbdYUME75j2eW+wC5eL+CsKaRKRnU6Qvvnl5OSnyScUuUnbs 3T2QSVme9wSB1m6UYWxpoILBCKBRSME= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X7hYVIN9iHd1LTjQv7uRYMcCiGgDiiOShTjqADvxK3A=; b=/IIkTLL0dy4ZOSzkUyTab0tuo7KZ4PT5bNhFXmOrXkbNa2Jkw1i+6i3KjV+ULFPa7bXblW XyBMcy7wVzxgnCDw== Received: from echidna.suse.de (unknown [10.163.47.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 429282C146; Mon, 20 Jun 2022 19:30:00 +0000 (UTC) From: David Disseldorp To: fstests@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 4/6] report: fix xunit tests count Date: Mon, 20 Jun 2022 21:29:32 +0200 Message-Id: <20220620192934.21694-5-ddiss@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220620192934.21694-1-ddiss@suse.de> References: <20220620192934.21694-1-ddiss@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org The xunit "section report" provides a tests attribute, which according to https://llg.cubic.org/docs/junit/ represents: tests="" The current value is generated as a sum of the $n_try and $n_notrun counters. This is incorrect as the $n_try counter already includes tests which are run but complete with _notrun. One special case exists for $showme (check -n), where $n_try remains zero, so $n_notrun can be used as-is. Signed-off-by: David Disseldorp Reviewed-by: Zorro Lang --- check | 13 ++++++------- common/report | 14 +++++++++----- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/check b/check index 43c072d2..a5183d3a 100755 --- a/check +++ b/check @@ -430,13 +430,12 @@ _wrapup() seq="check" check="$RESULT_BASE/check" - if $showme; then - if $needwrap; then - if $do_report; then - _make_section_report - fi - needwrap=false + if $showme && $needwrap; then + if $do_report; then + # $showme = all selected tests are notrun (no tries) + _make_section_report "$n_notrun" "0" "$n_notrun" fi + needwrap=false elif $needwrap; then if [ -f $check.time -a -f $tmp.time ]; then cat $check.time $tmp.time \ @@ -495,7 +494,7 @@ _wrapup() fi echo "" >>$tmp.summary if $do_report; then - _make_section_report + _make_section_report "$n_try" "$n_bad" "$n_notrun" fi needwrap=false fi diff --git a/common/report b/common/report index bf05afa9..84d9e0a7 100644 --- a/common/report +++ b/common/report @@ -49,9 +49,11 @@ _xunit_add_property() _xunit_make_section_report() { # xfstest:section ==> xunit:testsuite + local tests_count="$1" + local bad_count="$2" + local notrun_count="$3" local sect_name=$section local sect_time=`expr $sect_stop - $sect_start` - local n_total=`expr $n_try + $n_notrun` if [ $sect_name == '-no-sections-' ]; then sect_name='global' @@ -62,9 +64,8 @@ _xunit_make_section_report() if [ -z "$date_time" ]; then date_time=$(date +"%F %T") fi - local dtime=`echo $date_time| tr " " 'T'` - local stats="failures=\"$n_bad\" skipped=\"$n_notrun\" tests=\"$n_total\" time=\"$sect_time\"" - local hw_info="hostname=\"$HOST\" timestamp=\"$dtime\" " + local stats="failures=\"$bad_count\" skipped=\"$notrun_count\" tests=\"$tests_count\" time=\"$sect_time\"" + local hw_info="hostname=\"$HOST\" timestamp=\"${date_time/ /T}\" " echo "" >> $REPORT_DIR/result.xml # Properties @@ -149,10 +150,13 @@ _xunit_make_testcase_report() # Common report generator entry points _make_section_report() { + local tests_count="$1" + local bad_count="$2" + local notrun_count="$3" for report in $REPORT_LIST; do case "$report" in "xunit") - _xunit_make_section_report + _xunit_make_section_report "$tests_count" "$bad_count" "$notrun_count" ;; *) _dump_err "format '$report' is not supported" From patchwork Mon Jun 20 19:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 12888113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3705ECCA47F for ; Mon, 20 Jun 2022 19:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235019AbiFTTaF (ORCPT ); Mon, 20 Jun 2022 15:30:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238999AbiFTTaD (ORCPT ); Mon, 20 Jun 2022 15:30:03 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDD211C131 for ; Mon, 20 Jun 2022 12:30:01 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 7E0F721B3B for ; Mon, 20 Jun 2022 19:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ii+cN3r95AnqiCNSdql5UBJL//K6u+Mpx4//N7ngW5c=; b=fVCGScMuwee+pI5PoGAz1DE0xyGaTpxA+EC28gAvQU+uwd32OsQ42OnNNukZ8T71zKYIfJ diSXj+DNYEYN2RPhM5dM+Su8q0P/rgowkB0ipmARTrCvFof87yTREaqpdpHkYzziNXDT9C 1LF9DyX6w4PoUfuViCbOLQJ8wVDgXSg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ii+cN3r95AnqiCNSdql5UBJL//K6u+Mpx4//N7ngW5c=; b=tNnsIsuoSDzFTx7dkqNLSH85vs1/rijZ328ZcyhABkh4Mpo4mF8W3Kve9Yg8iweUCyKHgj an5zw65q3FYpjXBA== Received: from echidna.suse.de (unknown [10.163.47.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 6514B2C141; Mon, 20 Jun 2022 19:30:00 +0000 (UTC) From: David Disseldorp To: fstests@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 5/6] check: use arrays instead of separate n_ counters Date: Mon, 20 Jun 2022 21:29:33 +0200 Message-Id: <20220620192934.21694-6-ddiss@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220620192934.21694-1-ddiss@suse.de> References: <20220620192934.21694-1-ddiss@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org The separate n_try, n_bad and n_notrun counters are unnecessary when the corresponding lists are switched to bash arrays. Signed-off-by: David Disseldorp Reviewed-by: Zorro Lang --- check | 72 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 40 deletions(-) diff --git a/check b/check index a5183d3a..8423d7a1 100755 --- a/check +++ b/check @@ -8,13 +8,10 @@ tmp=/tmp/$$ status=0 needwrap=true needsum=true -n_try=0 -try="" -n_bad=0 +try=() sum_bad=0 -bad="" -n_notrun=0 -notrun="" +bad=() +notrun=() interrupt=true diff="diff -u" showme=false @@ -412,10 +409,9 @@ fi _wipe_counters() { - n_try="0" - n_bad="0" - n_notrun="0" - unset try notrun bad + try=() + notrun=() + bad=() } _global_log() { @@ -433,7 +429,7 @@ _wrapup() if $showme && $needwrap; then if $do_report; then # $showme = all selected tests are notrun (no tries) - _make_section_report "$n_notrun" "0" "$n_notrun" + _make_section_report "${#notrun[*]}" "0" "${#notrun[*]}" fi needwrap=false elif $needwrap; then @@ -458,12 +454,12 @@ _wrapup() echo "SECTION -- $section" >>$tmp.summary echo "=========================" >>$tmp.summary - if [ ! -z "$n_try" -a $n_try != 0 ]; then + if ((${#try[*]} > 0)); then if [ $brief_test_summary == "false" ]; then - echo "Ran:$try" - echo "Ran:$try" >>$tmp.summary + echo "Ran: ${try[*]}" + echo "Ran: ${try[*]}" >>$tmp.summary fi - _global_log "Ran:$try" + _global_log "Ran: ${try[*]}" fi $interrupt && echo "Interrupted!" | tee -a $check.log @@ -472,34 +468,34 @@ _wrapup() ${REPORT_DIR}/check.log fi - if [ ! -z "$notrun" ]; then + if ((${#notrun[*]} > 0)); then if [ $brief_test_summary == "false" ]; then - echo "Not run:$notrun" - echo "Not run:$notrun" >>$tmp.summary + echo "Not run: ${notrun[*]}" + echo "Not run: ${notrun[*]}" >>$tmp.summary fi - _global_log "Not run:$notrun" + _global_log "Not run: ${notrun[*]}" fi - if [ ! -z "$n_bad" -a $n_bad != 0 ]; then - echo "Failures:$bad" - echo "Failed $n_bad of $n_try tests" - _global_log "Failures:$bad" - _global_log "Failed $n_bad of $n_try tests" - echo "Failures:$bad" >>$tmp.summary - echo "Failed $n_bad of $n_try tests" >>$tmp.summary + if ((${#bad[*]} > 0)); then + echo "Failures: ${bad[*]}" + echo "Failed ${#bad[*]} of ${#try[*]} tests" + _global_log "Failures: ${bad[*]}" + _global_log "Failed ${#bad[*]} of ${#try[*]} tests" + echo "Failures: ${bad[*]}" >>$tmp.summary + echo "Failed ${#bad[*]} of ${#try[*]} tests" >>$tmp.summary else - echo "Passed all $n_try tests" - _global_log "Passed all $n_try tests" - echo "Passed all $n_try tests" >>$tmp.summary + echo "Passed all ${#try[*]} tests" + _global_log "Passed all ${#try[*]} tests" + echo "Passed all ${#try[*]} tests" >>$tmp.summary fi echo "" >>$tmp.summary if $do_report; then - _make_section_report "$n_try" "$n_bad" "$n_notrun" + _make_section_report "${#try[*]}" "${#bad[*]}" "${#notrun[*]}" fi needwrap=false fi - sum_bad=`expr $sum_bad + $n_bad` + sum_bad=`expr $sum_bad + ${#bad[*]}` _wipe_counters rm -f /tmp/*.rawout /tmp/*.out /tmp/*.err /tmp/*.time if ! $OPTIONS_HAVE_SECTIONS; then @@ -735,8 +731,7 @@ function run_section() for seq in $list ; do # Run report for previous test! if $err ; then - bad="$bad $seqnum" - n_bad=`expr $n_bad + 1` + bad+=("$seqnum") tc_status="fail" fi if $do_report && ! $first_test ; then @@ -794,7 +789,7 @@ function run_section() start=0 stop=0 tc_status="list" - n_notrun=`expr $n_notrun + 1` + notrun+=("$seqnum") continue fi @@ -815,8 +810,7 @@ function run_section() fi # record that we really tried to run this test. - try="$try $seqnum" - n_try=`expr $n_try + 1` + try+=("$seqnum") awk 'BEGIN {lasttime=" "} \ $1 == "'$seqnum'" {lasttime=" " $2 "s ... "; exit} \ @@ -861,8 +855,7 @@ function run_section() $timestamp && echo " [not run]" && \ echo -n " $seqnum -- " cat $seqres.notrun - notrun="$notrun $seqnum" - n_notrun=`expr $n_notrun + 1` + notrun+=("$seqnum") tc_status="notrun" # Unmount the scratch fs so that we can wipe the scratch @@ -947,8 +940,7 @@ function run_section() # make sure we record the status of the last test we ran. if $err ; then - bad="$bad $seqnum" - n_bad=`expr $n_bad + 1` + bad+=("$seqnum") tc_status="fail" fi if $do_report && ! $first_test ; then From patchwork Mon Jun 20 19:29:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 12888115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86BEECCA483 for ; Mon, 20 Jun 2022 19:30:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238999AbiFTTaG (ORCPT ); Mon, 20 Jun 2022 15:30:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238335AbiFTTaC (ORCPT ); Mon, 20 Jun 2022 15:30:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02C3D1C134 for ; Mon, 20 Jun 2022 12:30:01 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A00611FA1A for ; Mon, 20 Jun 2022 19:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dv8X83/H0/AqoMEIkHyrixu+09qrTAZ1+e/mze2fh0M=; b=EDAcHfrwTR3jN4hTQAGM+pn8UF2Oj85U2rurPyv1ZirQBoMt9dQRT+N5ctQ07Vo4uqYU+m MW340JRNuyOGko2d9QLJYOr1kr/Ei1sShqYgo5kfAq6bDWooE/w34p7AyV53/aljVihhXI WdwJ8xqS0++kQDhUz1d9yeub+EjAp7M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655753400; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dv8X83/H0/AqoMEIkHyrixu+09qrTAZ1+e/mze2fh0M=; b=Lp7FO+BlYKjx4NvY2xr/wp/w4X+ENlwEtnlqtf1OcYAE/b64ldCDHTn0LadrohNgw3+0se JXMpNC3sCEf/atDw== Received: from echidna.suse.de (unknown [10.163.47.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8644B2C143; Mon, 20 Jun 2022 19:30:00 +0000 (UTC) From: David Disseldorp To: fstests@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 6/6] check: remove err and first_test variables Date: Mon, 20 Jun 2022 21:29:34 +0200 Message-Id: <20220620192934.21694-7-ddiss@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220620192934.21694-1-ddiss@suse.de> References: <20220620192934.21694-1-ddiss@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org tc_status can be used for both of these. Signed-off-by: David Disseldorp Reviewed-by: Zorro Lang --- check | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/check b/check index 8423d7a1..2ea2920f 100755 --- a/check +++ b/check @@ -725,23 +725,17 @@ function run_section() seqres="$check" _check_test_fs - err=false - first_test=true + local tc_status="init" prev_seq="" for seq in $list ; do # Run report for previous test! - if $err ; then + if [ "$tc_status" == "fail" ]; then bad+=("$seqnum") - tc_status="fail" fi - if $do_report && ! $first_test ; then - if [ $tc_status != "expunge" ] ; then - _make_testcase_report "$prev_seq" "$tc_status" - fi + if $do_report && [[ ! $tc_status =~ ^(init|expunge)$ ]]; then + _make_testcase_report "$prev_seq" "$tc_status" fi - first_test=false - err=false prev_seq="$seq" if [ ! -f $seq ]; then # Try to get full name in case the user supplied only @@ -845,7 +839,7 @@ function run_section() if [ -f core ]; then _dump_err_cont "[dumped core]" mv core $RESULT_BASE/$seqnum.core - err=true + tc_status="fail" fi if [ -f $seqres.notrun ]; then @@ -870,15 +864,15 @@ function run_section() _scratch_unmount 2> /dev/null rm -f ${RESULT_DIR}/require_test* rm -f ${RESULT_DIR}/require_scratch* - err=true + tc_status="fail" else # The test apparently passed, so check for corruption # and log messages that shouldn't be there. Run the # checking tools from a subshell with adjusted OOM # score so that the OOM killer will target them instead # of the check script itself. - (_adjust_oom_score 250; _check_filesystems) || err=true - _check_dmesg || err=true + (_adjust_oom_score 250; _check_filesystems) || tc_status="fail" + _check_dmesg || tc_status="fail" fi # Reload the module after each test to check for leaks or @@ -892,7 +886,7 @@ function run_section() # Scan for memory leaks after every test so that associating # a leak to a particular test will be as accurate as possible. - _check_kmemleak || err=true + _check_kmemleak || tc_status="fail" # test ends after all checks are done. $timestamp && _timestamp @@ -900,7 +894,7 @@ function run_section() if [ ! -f $seq.out ]; then _dump_err "no qualified output" - err=true + tc_status="fail" continue; fi @@ -909,7 +903,7 @@ function run_section() # version. sed -i "s/\`/\'/g" $tmp.out if diff $seq.out $tmp.out >/dev/null 2>&1 ; then - if ! $err ; then + if [ "$tc_status" != "fail" ]; then echo "$seqnum `expr $stop - $start`" >>$tmp.time echo -n " `expr $stop - $start`s" fi @@ -926,10 +920,10 @@ function run_section() echo "(Run '$diff $here/$seq.out $seqres.out.bad'" \ " to see the entire diff)" fi; } | sed -e 's/^\(.\)/ \1/' - err=true + tc_status="fail" fi if [ -f $seqres.hints ]; then - if $err; then + if [ "$tc_status" == "fail" ]; then echo cat $seqres.hints else @@ -939,14 +933,11 @@ function run_section() done # make sure we record the status of the last test we ran. - if $err ; then + if [ "$tc_status" == "fail" ]; then bad+=("$seqnum") - tc_status="fail" fi - if $do_report && ! $first_test ; then - if [ $tc_status != "expunge" ] ; then - _make_testcase_report "$prev_seq" "$tc_status" - fi + if $do_report && [[ ! $tc_status =~ ^(init|expunge)$ ]]; then + _make_testcase_report "$prev_seq" "$tc_status" fi sect_stop=`_wallclock`