From nobody Sun Feb 8 19:57:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1677853764; cv=none; d=zohomail.com; s=zohoarc; b=M5aPLr5C4RkInzYOS55lvMUQ3Dw6A7RkblK910HxaC0k6uNo1zZpF4dZtrf1I+c9+CSi2vX+z+yCXN6pZF7WNVSRy5DDc0veQyaa/bdEXyKRmb4gHW2J7q0fO8Y8Kau2T/wSDObJN2E1LmNcBmRG560KrpGTFcVawI2yfJttxfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677853764; 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=3me4myzmIuFXHhfnQWxdxZgMU8hW70u+fWZ5uVkfyd0=; b=ULaewwJOFxXAkODs4pdrruMSiDzH3D+mqE9a10lFoDsNPL2OI2PVXqpVTDxLPlomKiT9+cfhK0Jee/B0F4l4/UAIrVrrDe36bc4z1+psOiixeqZumcp1M5u41XBEcfmQ72WdxKLkQHouTrWQx0yxW9B1++4uR/ePPie/k0XPPEk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1677853764022299.6601581603894; Fri, 3 Mar 2023 06:29:24 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-58-NO1G2f1_May8lwepAWKdAw-1; Fri, 03 Mar 2023 09:29:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 59E47280558F; Fri, 3 Mar 2023 14:29:16 +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 4566B2026D38; Fri, 3 Mar 2023 14:29:16 +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 207D819420AA; Fri, 3 Mar 2023 14:28:29 +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 A087A194208B for ; Fri, 3 Mar 2023 14:28:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9366940CF8EF; Fri, 3 Mar 2023 14:28:27 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 167514011AC8 for ; Fri, 3 Mar 2023 14:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677853762; 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=3me4myzmIuFXHhfnQWxdxZgMU8hW70u+fWZ5uVkfyd0=; b=JtdY2a56JnogXoyt5Cee0QG1AGVJujUrs74Me5q7ANkxYtO9dW6k50zBvrqJYpszzkYHfl hHSjJnjRWvWiyONFbd+Xu4pIesSqCDOyeodmvo6z+9lFwW/odfuvY8CAqXA7khVCKzGssR ludyjVgvJMCOGnxskOsbX9BzTcUPQJA= X-MC-Unique: NO1G2f1_May8lwepAWKdAw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 22/31] testutilsqemu: Introduce ARG_QEMU_CAPS_DEL, to mask out flags from real caps Date: Fri, 3 Mar 2023 15:27:56 +0100 Message-Id: <5fbbe59f10913a4ee087e95e18b47653f0df22ce.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.4 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: 1677853764898100001 Content-Type: text/plain; charset="utf-8" In certain cases we want to use as-real capabilities as possible but that doesn't allow testing certain fallback scenarios of features that can be complied out of QEMU. ARG_QEMU_CAPS_DEL can be used similarly to ARG_QEMU_CAPS but the flag arguments are actually masked out of the resulting caps. Signed-off-by: Peter Krempa --- tests/testutilsqemu.c | 12 ++++++++++++ tests/testutilsqemu.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 55de4bcdc6..54fa347d18 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -851,6 +851,14 @@ testQemuInfoSetArgs(struct testQemuInfo *info, ignore_value(virBitmapSetBit(info->args.fakeCapsAdd, flag)= ); break; + case ARG_QEMU_CAPS_DEL: + if (!(info->args.fakeCapsDel)) + info->args.fakeCapsDel =3D virBitmapNew(QEMU_CAPS_LAST); + + while ((flag =3D va_arg(argptr, int)) < QEMU_CAPS_LAST) + ignore_value(virBitmapSetBit(info->args.fakeCapsDel, flag)= ); + break; + case ARG_GIC: info->args.gic =3D va_arg(argptr, int); break; @@ -1000,6 +1008,9 @@ testQemuInfoInitArgs(struct testQemuInfo *info) for (cap =3D -1; (cap =3D virBitmapNextSetBit(info->args.fakeCapsAdd, = cap)) >=3D 0;) virQEMUCapsSet(info->qemuCaps, cap); + for (cap =3D -1; (cap =3D virBitmapNextSetBit(info->args.fakeCapsDel, = cap)) >=3D 0;) + virQEMUCapsClear(info->qemuCaps, cap); + if (info->args.gic !=3D GIC_NONE && testQemuCapsSetGIC(info->qemuCaps, info->args.gic) < 0) return -1; @@ -1017,6 +1028,7 @@ testQemuInfoClear(struct testQemuInfo *info) VIR_FREE(info->errfile); virObjectUnref(info->qemuCaps); g_clear_pointer(&info->args.fakeCapsAdd, virBitmapFree); + g_clear_pointer(&info->args.fakeCapsDel, virBitmapFree); g_clear_pointer(&info->args.fds, g_hash_table_unref); } diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index f272e6d41d..11bdd2fd2f 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -43,6 +43,7 @@ typedef enum { typedef enum { ARG_QEMU_CAPS =3D QEMU_CAPS_LAST + 1, + ARG_QEMU_CAPS_DEL, ARG_GIC, ARG_MIGRATE_FROM, ARG_MIGRATE_FD, @@ -82,6 +83,7 @@ typedef enum { struct testQemuArgs { bool newargs; virBitmap *fakeCapsAdd; + virBitmap *fakeCapsDel; char *capsver; char *capsarch; qemuTestCPUDef capsHostCPUModel; --=20 2.39.2