From nobody Fri Oct 18 08:51:48 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 1706636109507923.6672343974843; Tue, 30 Jan 2024 09:35:09 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6C73D1C3E; Tue, 30 Jan 2024 12:35:08 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id F2BD21D8B; Tue, 30 Jan 2024 12:10:32 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id D499D1D3D; Tue, 30 Jan 2024 12:09:45 -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 CEA751D14 for ; Tue, 30 Jan 2024 12:08:28 -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-296-D_68AgpnN6KG-LR-qlEAgg-1; Tue, 30 Jan 2024 12:08:26 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 9E76483538D for ; Tue, 30 Jan 2024 17:08:26 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16EAE2166B31 for ; Tue, 30 Jan 2024 17:08:25 +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: D_68AgpnN6KG-LR-qlEAgg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 16/31] virpcivpdtest: testPCIVPDResourceBasic: Remove tests for uninitialized 'ro'/'rw' section Date: Tue, 30 Jan 2024 18:07:54 +0100 Message-ID: <8a8423965c1cddc4b110cbde39252555d08978e7.1706633776.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 5MVYG2KU5B7KJ5UKF4FHFVCUWH5ZCMH3 X-Message-ID-Hash: 5MVYG2KU5B7KJ5UKF4FHFVCUWH5ZCMH3 X-MailFrom: pkrempa@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 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" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1706636110494100001 This is a synthetic case which tests the behaviour if the 'ro' or 'rw' struct members are uninitialized, basically excercising only a pointless programming-error NULL check in 'virPCIVPDResourceUpdateKeyword' as real usage does always pass a proper pointer. Signed-off-by: Peter Krempa --- tests/virpcivpdtest.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c index 8a2f337e85..20545759d5 100644 --- a/tests/virpcivpdtest.c +++ b/tests/virpcivpdtest.c @@ -64,11 +64,6 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED) {.keyword =3D "SN", .value =3D "serial2", .actual =3D &ro->serial_= number}, {.keyword =3D "serial_number", .value =3D "serial3", .actual =3D &= ro->serial_number}, }; - const TestPCIVPDKeywordValue readWriteCases[] =3D { - {.keyword =3D "YA", .value =3D "tag1", .actual =3D &ro->change_lev= el}, - {.keyword =3D "YA", .value =3D "tag2", .actual =3D &ro->change_lev= el}, - {.keyword =3D "asset_tag", .value =3D "tag3", .actual =3D &ro->cha= nge_level}, - }; const TestPCIVPDKeywordValue unsupportedFieldCases[] =3D { {.keyword =3D "FG", .value =3D "42", .actual =3D NULL}, {.keyword =3D "LC", .value =3D "42", .actual =3D NULL}, @@ -77,7 +72,6 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED) {.keyword =3D "EX", .value =3D "42", .actual =3D NULL}, }; size_t numROCases =3D G_N_ELEMENTS(readOnlyCases); - size_t numRWCases =3D G_N_ELEMENTS(readWriteCases); size_t numUnsupportedCases =3D G_N_ELEMENTS(unsupportedFieldCases); g_autoptr(virPCIVPDResource) res =3D g_new0(virPCIVPDResource, 1); virPCIVPDResourceCustom *custom =3D NULL; @@ -85,20 +79,6 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED) g_autofree char *val =3D g_strdup("testval"); res->name =3D g_steal_pointer(&val); - /* RO has not been initialized - make sure updates fail. */ - for (i =3D 0; i < numROCases; ++i) { - if (virPCIVPDResourceUpdateKeyword(res, true, - readOnlyCases[i].keyword, - readOnlyCases[i].value)) - return -1; - } - /* RW has not been initialized - make sure updates fail. */ - for (i =3D 0; i < numRWCases; ++i) { - if (virPCIVPDResourceUpdateKeyword(res, false, - readWriteCases[i].keyword, - readWriteCases[i].value)) - return -1; - } /* Initialize RO */ res->ro =3D g_steal_pointer(&ro); @@ -131,13 +111,6 @@ testPCIVPDResourceBasic(const void *data G_GNUC_UNUSED) return -1; } - /* Check that RW updates fail if RW has not been initialized. */ - if (virPCIVPDResourceUpdateKeyword(res, false, "YA", "tag1")) - return -1; - - if (virPCIVPDResourceUpdateKeyword(res, false, "asset_tag", "tag1")) - return -1; - /* Initialize RW */ res->rw =3D g_steal_pointer(&rw); if (!virPCIVPDResourceUpdateKeyword(res, false, "YA", "tag1") --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org