From nobody Mon Feb 9 01:06:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677853811; cv=none; d=zohomail.com; s=zohoarc; b=eEdpLP3ApVdsPWtr999Nvs4dfTUq9V1pVd/k5F2tiIWcx07/fvZwW7w2RDyX0UnYcje/2UHA26MkQUALrtfxC072GvjamkPhnqzGZ4rzwcJ22yPYufkre+dsHhCbai06qJBLr9HDrPJ0dQapeWt+2kSA5rJHKHjqM1S31789iIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677853811; h=Content-Type:Content-Transfer-Encoding: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=aNt9XkLWOJJp2crXfyNXlh5cRgUITN3IlwgOG0dL+Ko=; b=aClrjo3WWlZKLi8z1d85YIojVEe/ZxzW4P4tjDHwmSwTpwXe16zmea8sL97nMRnAns4dxoFnQcXWbL85bUPJ96oDDkgB7KaeYlEFiEV2DBRic2KXgJuvf4SGb/S4soZbHBk3oPyn8w7Lx5RrmEcHIHJ+eS+vaEU9eScaKLc42hE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1677853811343815.8345885408913; Fri, 3 Mar 2023 06:30:11 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-63-aY4rAUHaOfK9icTHAz2_Ow-1; Fri, 03 Mar 2023 09:29:14 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E8B9C185A7A4; Fri, 3 Mar 2023 14:29:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D583D1410DDA; Fri, 3 Mar 2023 14:29:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 52DAE1942B4D; Fri, 3 Mar 2023 14:28:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0F74B1948673 for ; Fri, 3 Mar 2023 14:28:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E748D403570C; Fri, 3 Mar 2023 14:28:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A2E94097544 for ; Fri, 3 Mar 2023 14:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677853810; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aNt9XkLWOJJp2crXfyNXlh5cRgUITN3IlwgOG0dL+Ko=; b=XpOdOxi4MoLZzYsTsDnAM+Ysy93PtWs7DLhieN/od0vrCcNyGQtZFflcU0iY4pQFANyvVv +lvES8bBipO6k44K6tFpI0D3ZLvVDt3TPxS/doHSlaXSv7vwsp9XyDz/989QcXNH7YaNtf WzyWq0gswkpv2Fia4ZlkdaEpysqD/Qo= X-MC-Unique: aY4rAUHaOfK9icTHAz2_Ow-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 20/31] qemuTestCapsCacheInsertImpl: Require that callers always pass capabilities Date: Fri, 3 Mar 2023 15:27:54 +0100 Message-Id: <177783ac0bd9eb847481f8514ed8d0063af0f07c.1677853487.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677853813239100002 Content-Type: text/plain; charset="utf-8" There's just one case when we're populating the cache with empty caps so that can allocate a dummy virQEMUCaps object rather than having the logic inside qemuTestCapsCacheInsertImpl. Signed-off-by: Peter Krempa --- tests/testutilsqemu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index b78634a436..18a9ca5ee1 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -492,7 +492,7 @@ qemuTestCapsCacheInsertImpl(virFileCache *cache, { size_t i; - if (caps && virQEMUCapsGetArch(caps) !=3D VIR_ARCH_NONE) { + if (virQEMUCapsGetArch(caps) !=3D VIR_ARCH_NONE) { /* all tests using real caps or arcitecture are expected to call: * * virFileCacheClear(driver.qemuCapsCache); @@ -531,10 +531,7 @@ qemuTestCapsCacheInsertImpl(virFileCache *cache, if (qemu_emulators[i] =3D=3D NULL) continue; - if (caps) - tmp =3D virQEMUCapsNewCopy(caps); - else - tmp =3D virQEMUCapsNew(); + tmp =3D virQEMUCapsNewCopy(caps); qemuTestCapsPopulateFakeMachines(tmp, i, hostOS); @@ -569,6 +566,7 @@ int qemuTestDriverInit(virQEMUDriver *driver) virSecurityManager *mgr =3D NULL; char statedir[] =3D STATEDIRTEMPLATE; char configdir[] =3D CONFIGDIRTEMPLATE; + g_autoptr(virQEMUCaps) emptyCaps =3D NULL; memset(driver, 0, sizeof(*driver)); @@ -625,7 +623,9 @@ int qemuTestDriverInit(virQEMUDriver *driver) if (!driver->xmlopt) goto error; - if (qemuTestCapsCacheInsert(driver->qemuCapsCache, NULL) < 0) + /* Populate the capabilities cache with fake empty caps */ + emptyCaps =3D virQEMUCapsNew(); + if (qemuTestCapsCacheInsert(driver->qemuCapsCache, emptyCaps) < 0) goto error; if (!(mgr =3D virSecurityManagerNew("none", "qemu", --=20 2.39.2