From nobody Wed Dec 17 05:43:07 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1642169358; cv=none; d=zohomail.com; s=zohoarc; b=HvEPb5Xxxz02OgQyQV90unxZbGe0w8HiP2wPN6MUYy4zYEDZYyAjuSXyipKTAxq4zIuKeOoEj8XSpY17m4URa3TJtok/2TsmG78kjvG4PPlLVI39YvDnUukWGz0m3UltJZ5Mw+ihVZmuMo/02iK2LRLjtfqA3TAavAHOAGnCL/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642169358; 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; bh=KMlqghHYUP4YhwTi8hsyxob4KH0JvCtGp488RsCVU9g=; b=kcohkR5uHXNniCgYOCWBtRq4wLxD1ZbCnB6lkvRJmF3yxQTFHDuolG8TjlDWN/rB4rRduG3J3udGdUSMGq6ZcGpw68dbAGkNZ3TjQQBRVhP3JYns+T50hLngSbbcmqnfkTL+6gFkB/FkLHystfKpNeMRzewC4FpiyyZJaZsF4/Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1642169358636652.5582313576923; Fri, 14 Jan 2022 06:09:18 -0800 (PST) Received: from localhost ([::1]:47160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n8NGX-0007Vs-Jc for importer@patchew.org; Fri, 14 Jan 2022 09:09:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n8N0m-0003K8-DM for qemu-devel@nongnu.org; Fri, 14 Jan 2022 08:53:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59070) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n8N0k-0000Op-Pl for qemu-devel@nongnu.org; Fri, 14 Jan 2022 08:53:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-14-sde32uDmNbSukS20dVrfaQ-1; Fri, 14 Jan 2022 08:52:53 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19C961054F90; Fri, 14 Jan 2022 13:52:52 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A3E5105B20E; Fri, 14 Jan 2022 13:52:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642168376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KMlqghHYUP4YhwTi8hsyxob4KH0JvCtGp488RsCVU9g=; b=S127vJ+CfuLmkKzmK9RVxOgxQGi2ADOCi49HanWuuXsqVIceAiJxzUkeMI011feHiuNdcl hkTW4UGAjl41TejZW8IC4nYhm7gUq6kekGAdZmyiEeiG3QzyRvobNSVGypeMWQ2vyv/7+W 1CQWLhgBhDdI4hnuL3l9LXY/NbkvakA= X-MC-Unique: sde32uDmNbSukS20dVrfaQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 16/16] iotests/testrunner.py: refactor test_field_width Date: Fri, 14 Jan 2022 14:52:26 +0100 Message-Id: <20220114135226.185407-17-kwolf@redhat.com> In-Reply-To: <20220114135226.185407-1-kwolf@redhat.com> References: <20220114135226.185407-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.595, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642169360214100003 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy A lot of Optional[] types doesn't make code beautiful. test_field_width defaults to 8, but that is never used in the code. More over, if we want some default behavior for single call of test_run(), it should just print the whole test name, not limiting or expanding its width, so 8 is bad default. So, just drop the default as unused for now. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211210201450.101576-1-vsementsov@virtuozzo.com> Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/testrunner.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunn= er.py index 0feaa396d0..15788f919e 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -174,19 +174,17 @@ def __enter__(self) -> 'TestRunner': def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> N= one: self._stack.close() =20 - def test_print_one_line(self, test: str, starttime: str, + def test_print_one_line(self, test: str, + test_field_width: int, + starttime: str, endtime: Optional[str] =3D None, status: str = =3D '...', lasttime: Optional[float] =3D None, thistime: Optional[float] =3D None, description: str =3D '', - test_field_width: Optional[int] =3D None, end: str =3D '\n') -> None: """ Print short test info before/after test run """ test =3D os.path.basename(test) =20 - if test_field_width is None: - test_field_width =3D 8 - if self.makecheck and status !=3D '...': if status and status !=3D 'pass': status =3D f' [{status}]' @@ -328,7 +326,7 @@ def do_run_test(self, test: str, mp: bool) -> TestResul= t: casenotrun=3Dcasenotrun) =20 def run_test(self, test: str, - test_field_width: Optional[int] =3D None, + test_field_width: int, mp: bool =3D False) -> TestResult: """ Run one test and print short status @@ -347,20 +345,21 @@ def run_test(self, test: str, =20 if not self.makecheck: self.test_print_one_line(test=3Dtest, + test_field_width=3Dtest_field_width, status =3D 'started' if mp else '...', starttime=3Dstart, lasttime=3Dlast_el, - end =3D '\n' if mp else '\r', - test_field_width=3Dtest_field_width) + end =3D '\n' if mp else '\r') =20 res =3D self.do_run_test(test, mp) =20 end =3D datetime.datetime.now().strftime('%H:%M:%S') - self.test_print_one_line(test=3Dtest, status=3Dres.status, + self.test_print_one_line(test=3Dtest, + test_field_width=3Dtest_field_width, + status=3Dres.status, starttime=3Dstart, endtime=3Dend, lasttime=3Dlast_el, thistime=3Dres.elapse= d, - description=3Dres.description, - test_field_width=3Dtest_field_width) + description=3Dres.description) =20 if res.casenotrun: print(res.casenotrun) --=20 2.31.1