From nobody Mon Feb 9 09:34:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1642689491493207.72904339335116; Thu, 20 Jan 2022 06:38:11 -0800 (PST) Received: from localhost ([::1]:43498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAYZl-00070D-IN for importer@patchew.org; Thu, 20 Jan 2022 09:38:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAVjq-0007ME-Rs; Thu, 20 Jan 2022 06:36:24 -0500 Received: from [2a00:1450:4864:20::32c] (port=53978 helo=mail-wm1-x32c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nAVjo-0001rJ-2i; Thu, 20 Jan 2022 06:36:21 -0500 Received: by mail-wm1-x32c.google.com with SMTP id n8so11419381wmk.3; Thu, 20 Jan 2022 03:36:11 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id w8sm2653423wrq.3.2022.01.20.03.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 03:36:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gE7kVOUWYMuX83tWlO/qFxRTGfJ+gjxaeF9Ye1Re6So=; b=VtFL2+7gedaLSXNStLSn6MJVbkfuSRF1G75KbVpeb6ddk/i16iNyUDBNKbCWrgXZMv KiwS5bDKvByhGd87jl/buADhAtOU9obBLrnx9UcASFfw0h8UuFgYnDU6dNiZdhS//uJh CTVdshMg8qcTRmQ8g1SslbOeS+xNxitUgGU8dywQLK/l48XjQvjVGlcdGmcuTVwwXPfi maMgMZQ8nh7f/B9YJ1Ogjl7sU+cHTPbLssDpVQ7IJUzN21UvqlZtGxPUmJ8R2HW2X6GD Ci777vc9fT/MzMMk0EKorUG5pzeO4FZZjZjgHGNRyNWfIG8Em2/wuxEAcwD6dVQPqzhH AbZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gE7kVOUWYMuX83tWlO/qFxRTGfJ+gjxaeF9Ye1Re6So=; b=f43dhDR/nk0GZO+WIRQrEq7ptdLHUXVNCs590iQZ5MnaT0Ojcx3FW+ZcM/H7LRuqhE kvaZA5l42yHugIKHc/Grh49kXKWC3Mzh4lJuy876DXOduMDgSOn+irsXpCjtVsQI0l7y 4LRn6mUvgQrogXtcxBxpHYRrRFnkidizlMTkyfl9ipz/F1i2NmmsEmUMDK1q1lzLW4Pw d7lRNtxKLJbPKeVHc7wn+6+mTuykN3HM1Mm3i4ozCGVJwzGKVdndGejdrUbs69fDQX/q v4YiI8AuJzv/hYwDsFGkwTvxBg1AGcj7TO1nBptN8bmJZwh9BWmfCyifq1p0+NuItwf3 KV+w== X-Gm-Message-State: AOAM533mqfhj2rT9zylpQeh6xIT7kv5+MCJr89fXt8pRv0CY4ZJGXLSK skgGbE5L5jT30J/ee0k1/qSIUP+JC2g= X-Google-Smtp-Source: ABdhPJx7Cg23fAC3eywv98yXin9Y8nyX8bJCcF7Vr6PL28c4RvcDB2gW1o07IkbQeBhYCuhCz72KBg== X-Received: by 2002:a05:600c:2690:: with SMTP id 16mr8353057wmt.146.1642678570125; Thu, 20 Jan 2022 03:36:10 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 4/4] check-block: replace -makecheck with TAP output Date: Thu, 20 Jan 2022 12:36:03 +0100 Message-Id: <20220120113603.276144-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220120113603.276144-1-pbonzini@redhat.com> References: <20220120113603.276144-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32c (failed) 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=2a00:1450:4864:20::32c; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: thuth@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1642689493364100001 Content-Type: text/plain; charset="utf-8" Let "meson test" take care of showing the results of the individual tests, consistently with other output from "make check V=3D1". Signed-off-by: Paolo Bonzini --- tests/check-block.sh | 6 ++-- tests/qemu-iotests/check | 6 ++-- tests/qemu-iotests/meson.build | 1 + tests/qemu-iotests/testenv.py | 30 +++++++++---------- tests/qemu-iotests/testrunner.py | 49 +++++++++++++++++--------------- 5 files changed, 48 insertions(+), 44 deletions(-) diff --git a/tests/check-block.sh b/tests/check-block.sh index 88e02453d2..720a46bc36 100755 --- a/tests/check-block.sh +++ b/tests/check-block.sh @@ -14,8 +14,8 @@ else fi =20 skip() { - echo "$*" - exit 77 + echo "1..0 #SKIP $*" + exit 0 } =20 if grep -q "CONFIG_GPROF=3Dy" config-host.mak 2>/dev/null ; then @@ -79,7 +79,7 @@ JOBS=3D$(echo "$MAKEFLAGS" | sed -n 's/\(^\|.* \)-j\([0-9= ]\+\)\( .*\|$\)/-j \2/p') =20 ret=3D0 for fmt in $format_list ; do - ${PYTHON} ./check $JOBS -makecheck -$fmt $group || ret=3D1 + ${PYTHON} ./check $JOBS -tap -$fmt $group || ret=3D1 done =20 exit $ret diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 0c27721a41..75de1b4691 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -32,8 +32,6 @@ def make_argparser() -> argparse.ArgumentParser: =20 p.add_argument('-n', '--dry-run', action=3D'store_true', help=3D'show me, do not run tests') - p.add_argument('-makecheck', action=3D'store_true', - help=3D'pretty print output for make check') p.add_argument('-j', dest=3D'jobs', type=3Dint, default=3D1, help=3D'run tests in multiple parallel jobs') =20 @@ -53,6 +51,8 @@ def make_argparser() -> argparse.ArgumentParser: p.add_argument('--color', choices=3D['on', 'off', 'auto'], default=3D'auto', help=3D"use terminal colors. The defa= ult " "'auto' value means use colors if terminal stdout detec= ted") + p.add_argument('-tap', action=3D'store_true', + help=3D'produce TAP output') =20 g_env =3D p.add_argument_group('test environment options') mg =3D g_env.add_mutually_exclusive_group() @@ -164,7 +164,7 @@ if __name__ =3D=3D '__main__': if args.dry_run: print('\n'.join(tests)) else: - with TestRunner(env, makecheck=3Dargs.makecheck, + with TestRunner(env, tap=3Dargs.tap, color=3Dargs.color) as tr: paths =3D [os.path.join(env.source_iotests, t) for t in tests] ok =3D tr.run_tests(paths, args.jobs) diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build index 3a9425d15c..5be3c74127 100644 --- a/tests/qemu-iotests/meson.build +++ b/tests/qemu-iotests/meson.build @@ -22,6 +22,7 @@ if have_tools and targetos !=3D 'windows' endif test('qemu-iotests ' + format, sh, args: [files('../check-block.sh'), = format], depends: qemu_iotests_binaries, env: qemu_iotests_env, + protocol: 'tap', suite: suites, timeout: 0, is_parallel: false) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index c33454fa68..0f32897fe8 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -287,21 +287,21 @@ def __enter__(self) -> 'TestEnv': def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> N= one: self.close() =20 - def print_env(self) -> None: + def print_env(self, prefix: str =3D '') -> None: template =3D """\ -QEMU -- "{QEMU_PROG}" {QEMU_OPTIONS} -QEMU_IMG -- "{QEMU_IMG_PROG}" {QEMU_IMG_OPTIONS} -QEMU_IO -- "{QEMU_IO_PROG}" {QEMU_IO_OPTIONS} -QEMU_NBD -- "{QEMU_NBD_PROG}" {QEMU_NBD_OPTIONS} -IMGFMT -- {IMGFMT}{imgopts} -IMGPROTO -- {IMGPROTO} -PLATFORM -- {platform} -TEST_DIR -- {TEST_DIR} -SOCK_DIR -- {SOCK_DIR} -GDB_OPTIONS -- {GDB_OPTIONS} -VALGRIND_QEMU -- {VALGRIND_QEMU} -PRINT_QEMU_OUTPUT -- {PRINT_QEMU} -""" +{prefix}QEMU -- "{QEMU_PROG}" {QEMU_OPTIONS} +{prefix}QEMU_IMG -- "{QEMU_IMG_PROG}" {QEMU_IMG_OPTIONS} +{prefix}QEMU_IO -- "{QEMU_IO_PROG}" {QEMU_IO_OPTIONS} +{prefix}QEMU_NBD -- "{QEMU_NBD_PROG}" {QEMU_NBD_OPTIONS} +{prefix}IMGFMT -- {IMGFMT}{imgopts} +{prefix}IMGPROTO -- {IMGPROTO} +{prefix}PLATFORM -- {platform} +{prefix}TEST_DIR -- {TEST_DIR} +{prefix}SOCK_DIR -- {SOCK_DIR} +{prefix}GDB_OPTIONS -- {GDB_OPTIONS} +{prefix}VALGRIND_QEMU -- {VALGRIND_QEMU} +{prefix}PRINT_QEMU_OUTPUT -- {PRINT_QEMU} +{prefix}""" =20 args =3D collections.defaultdict(str, self.get_env()) =20 @@ -310,5 +310,5 @@ def print_env(self) -> None: =20 u =3D os.uname() args['platform'] =3D f'{u.sysname}/{u.machine} {u.nodename} {u.rel= ease}' - + args['prefix'] =3D prefix print(template.format_map(args)) diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunn= er.py index 15788f919e..0eace147b8 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -152,10 +152,10 @@ def run_tests_pool(self, tests: List[str], =20 return results =20 - def __init__(self, env: TestEnv, makecheck: bool =3D False, + def __init__(self, env: TestEnv, tap: bool =3D False, color: str =3D 'auto') -> None: self.env =3D env - self.makecheck =3D makecheck + self.tap =3D tap self.last_elapsed =3D LastElapsedTime('.last-elapsed-cache', env) =20 assert color in ('auto', 'on', 'off') @@ -185,13 +185,16 @@ def test_print_one_line(self, test: str, """ Print short test info before/after test run """ test =3D os.path.basename(test) =20 - if self.makecheck and status !=3D '...': - if status and status !=3D 'pass': - status =3D f' [{status}]' - else: - status =3D '' + if test_field_width is None: + test_field_width =3D 8 =20 - print(f' TEST iotest-{self.env.imgfmt}: {test}{status}') + if self.tap: + if status =3D=3D 'pass': + print(f'ok {self.env.imgfmt} {test}') + elif status =3D=3D 'fail': + print(f'not ok {self.env.imgfmt} {test}') + elif status =3D=3D 'not run': + print(f'ok {self.env.imgfmt} {test} # SKIP') return =20 if lasttime: @@ -343,7 +346,7 @@ def run_test(self, test: str, last_el =3D self.last_elapsed.get(test) start =3D datetime.datetime.now().strftime('%H:%M:%S') =20 - if not self.makecheck: + if not self.tap: self.test_print_one_line(test=3Dtest, test_field_width=3Dtest_field_width, status =3D 'started' if mp else '...', @@ -372,7 +375,9 @@ def run_tests(self, tests: List[str], jobs: int =3D 1) = -> bool: notrun =3D [] casenotrun =3D [] =20 - if not self.makecheck: + if self.tap: + self.env.print_env('# ') + else: self.env.print_env() =20 test_field_width =3D max(len(os.path.basename(t)) for t in tests) = + 2 @@ -398,8 +403,6 @@ def run_tests(self, tests: List[str], jobs: int =3D 1) = -> bool: =20 if res.status =3D=3D 'fail': failed.append(name) - if self.makecheck: - self.env.print_env() if res.diff: print('\n'.join(res.diff)) elif res.status =3D=3D 'not run': @@ -412,16 +415,16 @@ def run_tests(self, tests: List[str], jobs: int =3D 1= ) -> bool: if res.interrupted: break =20 - if notrun: - print('Not run:', ' '.join(notrun)) + if not self.tap: + if notrun: + print('Not run:', ' '.join(notrun)) =20 - if casenotrun: - print('Some cases not run in:', ' '.join(casenotrun)) + if casenotrun: + print('Some cases not run in:', ' '.join(casenotrun)) =20 - if failed: - print('Failures:', ' '.join(failed)) - print(f'Failed {len(failed)} of {n_run} iotests') - return False - else: - print(f'Passed all {n_run} iotests') - return True + if failed: + print('Failures:', ' '.join(failed)) + print(f'Failed {len(failed)} of {n_run} iotests') + else: + print(f'Passed all {n_run} iotests') + return not failed --=20 2.33.1