From nobody Tue Feb 10 00:39:36 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 ARC-Seal: i=1; a=rsa-sha256; t=1620039907; cv=none; d=zohomail.com; s=zohoarc; b=Vb+LYMIpGWrdpxZscWakmo3Nyp8FgTnsdDtMY/FFOzXAPdkWomyn0ApevclLYhpj0a6rBH+S7IRW0pjzeWBs0nqfNFQBqkTXHZSEuFKVYx71BVam47HXPAL2IfzGlCDWY1/Tx8b8wdQnoJa4XrvKC/MG+6RCWH6BUgH5LOfarkE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620039907; h=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=CiZrOooOA5sLacn8XFpn97ElSByrel0Yqy/GkIYhy78=; b=UvUXF4eyuGDYAyuGqRTWGsYLHwq+8MOu/Fmz4B8hoXswph459eK3lXUC7ShtL8SSUKwPwzsWsLiHQSVwf0oypLTRJvBfv8b8gMjUk8G/41VogTx0F9pSm0VQCDlmMUEjkC8Yo55hNDw+kumBP+O8jbl05+damjqNpt9GUZQmaUM= ARC-Authentication-Results: i=1; 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 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 1620039907197958.5037014000267; Mon, 3 May 2021 04:05:07 -0700 (PDT) Received: from localhost ([::1]:42168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldWNu-0005Ru-4f for importer@patchew.org; Mon, 03 May 2021 07:05:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldWKL-0001ry-FN for qemu-devel@nongnu.org; Mon, 03 May 2021 07:01:25 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:33661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldWKJ-0004t4-RF for qemu-devel@nongnu.org; Mon, 03 May 2021 07:01:25 -0400 Received: by mail-ed1-x529.google.com with SMTP id b17so2744272ede.0 for ; Mon, 03 May 2021 04:01:23 -0700 (PDT) Received: from localhost.localdomain ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id v16sm12041464edt.53.2021.05.03.04.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 04:01:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CiZrOooOA5sLacn8XFpn97ElSByrel0Yqy/GkIYhy78=; b=qe6JWCPTGRVjPNg/ZPqM+ZBd8qV1uPqAEYTFuDj5hzSxCoRrqeNHY6JWk2nuhQk9B/ zhTy8btk3sMU1WFfVz7OAxXau6qgU9PnGo+4/WiTYLW8V2RRe4KqaJgovr6qTUdgSdKU gE71huYr6Vx94DuS+jmolgBYtmtzDxwAv7NePRf97xhRhUZ2sh5U+QwZhlr0rh+xRyuI dWUYqXOZ7NCGayeWn72XlmhHZGQbQHKp4xjge+s/Imq7rGOwYhBqEJ+FiuKUj55XJdmP 5BSxZUIhMKkmHT5w8vASjuKyb53hKA9uyQGU6MQgYShhXuHPw6JlXuYvACdRW1a5UrtI t+hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=CiZrOooOA5sLacn8XFpn97ElSByrel0Yqy/GkIYhy78=; b=jioyCBxGy0GwU0ihjoGqlsCDB9CfkHRNFqT8him1tv+3tBAO7g7Mqace92QsclNuns MV1v2LsaBHb+DvmSBZsr2nkFkj9GT5luQErreQHSpryZW/aN3Tw5L1WVks5PlbIuN9Yl ZDJ71dP7SurCObUklE12oegH83GV99Td1TcXTB0xCcqlxMI/OIlpRjpxXBTEJIzWxo0m s4Oj3oLPF3/0noV166DWAs8AbCPqcZHPCmWsnuKQXcesyO6fMxCKJtarK+pIGwY+q8BE uTVFv+0AQ+0OiB5vuLOW3wT7oHIpkHi54fqCkGNaWSnjFJnMBvx866xXwSskdaAfgwcA 6xOA== X-Gm-Message-State: AOAM5310SszdZGF2Q1I3dIvyf0OY4j/Wn1PRnrYW7KCZVs0TWZoD0QZX 49Lyb3s4p7EpQWunKJ7h1rjjkD2U6hs= X-Google-Smtp-Source: ABdhPJzPqIt0rS9K5kqoXgUqv1j80lYsU77kaI2oCagpTfiDLrsIuu996nkcXPQhulPsn4B7SWApMg== X-Received: by 2002:aa7:ccc4:: with SMTP id y4mr18841994edt.171.1620039677727; Mon, 03 May 2021 04:01:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v4 4/5] qemu-iotests: let "check" spawn an arbitrary test command Date: Mon, 3 May 2021 13:01:09 +0200 Message-Id: <20210503110110.476887-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210503110110.476887-1-pbonzini@redhat.com> References: <20210503110110.476887-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::529; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 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.249, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: eesposit@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Right now there is no easy way for "check" to print a reproducer command. Because such a reproducer command line would be huge, we can instead teach check to start a command of our choice. This can be for example a Python unit test with arguments to only run a specific subtest. Move the trailing empty line to print_env(), since it always looks better and one caller was not adding it. Signed-off-by: Paolo Bonzini Reviewed-by: Vladimir Sementsov-Ogievskiy Tested-by: Emanuele Giuseppe Esposito Message-Id: <20210323181928.311862-5-pbonzini@redhat.com> --- tests/qemu-iotests/check | 19 ++++++++++++++++++- tests/qemu-iotests/testenv.py | 3 ++- tests/qemu-iotests/testrunner.py | 1 - 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index d1c87ceaf1..7c9d3a0852 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -19,6 +19,9 @@ import os import sys import argparse +import shutil +from pathlib import Path + from findtests import TestFinder from testenv import TestEnv from testrunner import TestRunner @@ -101,7 +104,7 @@ def make_argparser() -> argparse.ArgumentParser: 'rerun failed ./check command, starting from the ' 'middle of the process.') g_sel.add_argument('tests', metavar=3D'TEST_FILES', nargs=3D'*', - help=3D'tests to run') + help=3D'tests to run, or "--" followed by a command= ') =20 return p =20 @@ -114,6 +117,20 @@ if __name__ =3D=3D '__main__': imgopts=3Dargs.imgopts, misalign=3Dargs.misalign, debug=3Dargs.debug, valgrind=3Dargs.valgrind) =20 + if len(sys.argv) > 1 and sys.argv[-len(args.tests)-1] =3D=3D '--': + if not args.tests: + sys.exit("missing command after '--'") + cmd =3D args.tests + env.print_env() + exec_pathstr =3D shutil.which(cmd[0]) + if exec_pathstr is None: + sys.exit('command not found: ' + cmd[0]) + exec_path =3D Path(exec_pathstr).resolve() + cmd[0] =3D str(exec_path) + full_env =3D env.prepare_subprocess(cmd) + os.chdir(exec_path.parent) + os.execve(cmd[0], cmd, full_env) + testfinder =3D TestFinder(test_dir=3Denv.source_iotests) =20 groups =3D args.groups.split(',') if args.groups else None diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index fca3a609e0..cd0e39b789 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -284,7 +284,8 @@ def print_env(self) -> None: PLATFORM -- {platform} TEST_DIR -- {TEST_DIR} SOCK_DIR -- {SOCK_DIR} -SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER}""" +SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER} +""" =20 args =3D collections.defaultdict(str, self.get_env()) =20 diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunn= er.py index 519924dc81..2f56ac545d 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -316,7 +316,6 @@ def run_tests(self, tests: List[str]) -> bool: =20 if not self.makecheck: self.env.print_env() - print() =20 test_field_width =3D max(len(os.path.basename(t)) for t in tests) = + 2 =20 --=20 2.31.1