From nobody Fri May 10 06:34:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 169930338884773.42574121004805; Mon, 6 Nov 2023 12:43:08 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7E14D19B8; Mon, 6 Nov 2023 15:43:07 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 099011996; Mon, 6 Nov 2023 15:41:43 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A1AE61984; Mon, 6 Nov 2023 15:41:38 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AFB4F1981 for ; Mon, 6 Nov 2023 15:41:37 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-626--TqDJsRMOtC7zuK0vS8x7g-1; Mon, 06 Nov 2023 15:41:35 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E2A2D811E91 for ; Mon, 6 Nov 2023 20:41:34 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.2.18.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B472A1121307; Mon, 6 Nov 2023 20:41:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: -TqDJsRMOtC7zuK0vS8x7g-1 From: Jonathon Jongsma To: devel@lists.libvirt.org Subject: [libvirt PATCH] test: remove redundant cpuTestGuestCPUID test Date: Mon, 6 Nov 2023 14:41:34 -0600 Message-ID: <20231106204134.3664715-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: LK72J3G6QYCLXA7V3S3P4WRGDFQEEX7Y X-Message-ID-Hash: LK72J3G6QYCLXA7V3S3P4WRGDFQEEX7Y X-MailFrom: jjongsma@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jdenemar@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1699303389786100001 DO_TEST_CPUID(arch, host, json) is a multipart test. It consists of the following tests: - cpuTestHostCPUID() - cpuTestGuestCPUID(with JSON_* flag) - cpuTestCPUIDSignature() - DO_TEST_JSON(): - if json=3D=3DJSON_MODELS: - cpuTestGuestCPUID(without JSON_* flag) - cpuTestJSONCPUID() - cputestJSONSignature() Notice that for tests with json=3D=3DJSON_MODELS, cpuTestGuestCPUID() is actually called twice but with different arguments. The first one passes JSON_MODELS to the test function, while the second one passes 0. The main difference in behavior when calling cpuTestGuestCPUID() with or without the flag is that in the first case, it parses the captured qemu output from $ARCH-cpuid-$CPU.json. It extracts the cpu model list from that JSON, and uses that to filter out possible cpu models to match. In other words, it tries to match the cpu to a model that was supported by the qemu version that was used to generate this JSON file. When it finds a match, it generates a cpu definition and compares the xml form of that definition with the file $ARCH-cpuid-$CPU-guest.xml. When called without the JSON_MODELS flag, it simply attempts to match it against the full libvirt cpu map and doesn't attempt to filter out any matches based on the JSON qemu cpu model list. After it finds a match, it generates an xml definition for the cpu and compares it to the same file listed above. So if these two invocations disagree on the cpu match (e.g. because libvirt has added a cpu model to its cpu map that matches better than one that was supported by the version of qemu that generated the JSON file) the test will fail. This duplicate call to cpuTestGuestCPUID() was originally added in commit 49c945a6f5c885394507f88086cc2f9461df7c27. The original justification for that commit was to fix test failures when the Qemu driver was disabled. But since DO_TEST_JSON() is #defined empty when qemu is disabled, this particular invocation would not even be executed in this scenario, so it doesn't seem relevant. Signed-off-by: Jonathon Jongsma Reviewed-by: Michal Privoznik --- tests/cputest.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index b3253e3116..93cd0e12a7 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -993,10 +993,6 @@ mymain(void) #if WITH_QEMU # define DO_TEST_JSON(arch, host, json) \ do { \ - if (json =3D=3D JSON_MODELS) { \ - DO_TEST(arch, cpuTestGuestCPUID, host, host, \ - NULL, NULL, 0, NULL, 0, 0); \ - } \ if (json !=3D JSON_NONE) { \ DO_TEST(arch, cpuTestJSONCPUID, host, host, \ NULL, NULL, 0, NULL, json, 0); \ --=20 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org