From nobody Mon Feb 9 16:50:37 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 1644315710960861.0839500127444; Tue, 8 Feb 2022 02:21:50 -0800 (PST) Received: from localhost ([::1]:43882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHNd7-0008M1-ML for importer@patchew.org; Tue, 08 Feb 2022 05:21:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHNV2-0006Zv-90 for qemu-devel@nongnu.org; Tue, 08 Feb 2022 05:13:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHNV0-0003WV-2A for qemu-devel@nongnu.org; Tue, 08 Feb 2022 05:13:27 -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-607-sxYn3gV2OrS8C-TjKviiiQ-1; Tue, 08 Feb 2022 05:13:22 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89AF0835B74; Tue, 8 Feb 2022 10:13:21 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4E1E2A182; Tue, 8 Feb 2022 10:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644315205; 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=yJ7ga4OVxPAFbEoiqCPWMcvTKn1SeVT+NFgRh/tiCf4=; b=IT4gEH50R2Yj6nLSOrknASs2T8LFOxZXLgl27MiMU9xw5QRB0NUc3DU0hcPVs0z1geg524 ccU0RalfCMfPK1KcVGF1WFtUKtEjShxZmybJ5QWQCDvI8MUdA4lkmCh0iSo6XIKJ9Uv+YK VpETO7P1/Ifee/KhZhebSezYS44PEzc= X-MC-Unique: sxYn3gV2OrS8C-TjKviiiQ-1 From: Thomas Huth To: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf Subject: [PATCH 3/6] tests/qemu-iotests: Allow to run "./check -n" from the source directory, too Date: Tue, 8 Feb 2022 11:13:08 +0100 Message-Id: <20220208101311.1511083-4-thuth@redhat.com> In-Reply-To: <20220208101311.1511083-1-thuth@redhat.com> References: <20220208101311.1511083-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@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.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: Paolo Bonzini , qemu-devel@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: 1644315711379100001 Content-Type: text/plain; charset="utf-8" For better integration of the iotests into the meson build system, it would be very helpful to get the list of the tests in the "auto" group during the "configure" step already. However, "check -n -g auto" currently only works if the binaries have already been built. Re-order the code in the "check" a little bit so that we can use the -n option without building the binaries first. Signed-off-by: Thomas Huth --- tests/qemu-iotests/check | 52 ++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 75de1b4691..0fa75abf13 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -120,6 +120,30 @@ def make_argparser() -> argparse.ArgumentParser: if __name__ =3D=3D '__main__': args =3D make_argparser().parse_args() =20 + if os.path.islink(sys.argv[0]): + # called from the build tree + source_iotests =3D os.path.dirname(os.readlink(sys.argv[0])) + else: + source_iotests =3D os.getcwd() + + testfinder =3D TestFinder(source_iotests) + + groups =3D args.groups.split(',') if args.groups else None + x_groups =3D args.exclude_groups.split(',') if args.exclude_groups els= e None + + try: + tests =3D testfinder.find_tests(groups=3Dgroups, exclude_groups=3D= x_groups, + tests=3Dargs.tests, + start_from=3Dargs.start_from) + if not tests: + raise ValueError('No tests selected') + except ValueError as e: + sys.exit(e) + + if args.dry_run: + print('\n'.join(tests)) + sys.exit(0) + env =3D TestEnv(imgfmt=3Dargs.imgfmt, imgproto=3Dargs.imgproto, aiomode=3Dargs.aiomode, cachemode=3Dargs.cachemode, imgopts=3Dargs.imgopts, misalign=3Dargs.misalign, @@ -140,11 +164,6 @@ if __name__ =3D=3D '__main__': os.chdir(exec_path.parent) os.execve(cmd[0], cmd, full_env) =20 - testfinder =3D TestFinder(test_dir=3Denv.source_iotests) - - groups =3D args.groups.split(',') if args.groups else None - x_groups =3D args.exclude_groups.split(',') if args.exclude_groups els= e None - group_local =3D os.path.join(env.source_iotests, 'group.local') if os.path.isfile(group_local): try: @@ -152,21 +171,8 @@ if __name__ =3D=3D '__main__': except ValueError as e: sys.exit(f"Failed to parse group file '{group_local}': {e}") =20 - try: - tests =3D testfinder.find_tests(groups=3Dgroups, exclude_groups=3D= x_groups, - tests=3Dargs.tests, - start_from=3Dargs.start_from) - if not tests: - raise ValueError('No tests selected') - except ValueError as e: - sys.exit(e) - - if args.dry_run: - print('\n'.join(tests)) - else: - 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) - if not ok: - sys.exit(1) + 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) + if not ok: + sys.exit(1) --=20 2.27.0