From nobody Sun Oct 5 01:47:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1757419928; cv=none; d=zohomail.com; s=zohoarc; b=R1Q/fvJCO7NqxTteaS2uuRp8jADDfaFMJmpConQmW1JIGN0lYRQwNfHZpInegsZaoRMFbaxXsGBXCQHaAlNNo1npBSPQJrLBAfAcF2BgACARtZptHu4HkE8ApPXsKnCjYcLjDgDr/ne9fsnr9j78ar/Uu0m/TA0YSQ7pPlwBDPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757419928; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=eGKJNYdbWdZgQ5/eJnEzrpV7Ku2Vsxk+GTlfr1oRrMQ=; b=gI89zGwlMcDBZvdf8ZsMF2YNlNlSVyxupVbVjjFcMxYyu3bBiZ+6GD9RdIsjT9slDB6Shq08jn6rcj/JghoDcKE3712bgVl099JaWmOjnXIzhqod9IwyJ7b1H9o18W9bA9QDII5w465nzuQDiYoVSweV/44MXily2fuSufp/ECw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 175741992859739.73893985923473; Tue, 9 Sep 2025 05:12:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B359F41B13; Tue, 9 Sep 2025 08:12:07 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 7909B43E1E; Tue, 9 Sep 2025 08:07:44 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6CF3841ADE; Tue, 9 Sep 2025 08:06:45 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C773B41ADB for ; Tue, 9 Sep 2025 08:06:43 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-547-rouFjkq-OByEzxI1reuDpA-1; Tue, 09 Sep 2025 08:06:41 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EFF111956096 for ; Tue, 9 Sep 2025 12:06:40 +0000 (UTC) Received: from hjs (unknown [10.43.3.187]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 55F981956095 for ; Tue, 9 Sep 2025 12:06:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757419603; h=from:from: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; bh=eGKJNYdbWdZgQ5/eJnEzrpV7Ku2Vsxk+GTlfr1oRrMQ=; b=RIxcq+uhCdlnY5n3dIfXaPiNKdfgNGIZW2PDidtfQaq4W4eWyx7Dg/wq+kBbiJsHCOG2ZV PZFz2yY85vsFwmZsPyHnr/2eCus9wLMnLsXa0fUbAkM5B8hvwpewERInAE2fYOa7CGNMhO RbHpELYmKf5NhYAuvHFHTJr5n1WpOq0= X-MC-Unique: rouFjkq-OByEzxI1reuDpA-1 X-Mimecast-MFC-AGG-ID: rouFjkq-OByEzxI1reuDpA_1757419601 To: devel@lists.libvirt.org Subject: [libvirt PATCH 5/8] tests: qemuxmlconftest: test passt command line too Date: Tue, 9 Sep 2025 14:05:46 +0200 Message-ID: <0818b75a9ab78960f724201ac784d78d5d61155a.1757419549.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 6K-aMROkMiF2bweG0Nhq6YGsEm1wwl4dS_NSxTrhJw0_1757419601 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VP3SO4ZXYXHXIF4T37TGSIGKP2UVBQT4 X-Message-ID-Hash: VP3SO4ZXYXHXIF4T37TGSIGKP2UVBQT4 X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?J=C3=A1n_Tomko_via_Devel?= Reply-To: =?UTF-8?q?J=C3=A1n=20Tomko?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1757419929666116600 From: J=C3=A1n Tomko Introduce testing of the generated command line arguments of helper binaries too, not just QEMU. Start with passt. Signed-off-by: J=C3=A1n Tomko --- .../net-user-passt.x86_64-7.2.0.passt0.args | 13 ++++ .../net-user-passt.x86_64-latest.passt0.args | 13 ++++ ...-vhostuser-passt.x86_64-latest.passt0.args | 14 ++++ ...-vhostuser-passt.x86_64-latest.passt1.args | 5 ++ ...-vhostuser-passt.x86_64-latest.passt2.args | 6 ++ ...main-subelements.x86_64-latest.passt0.args | 7 ++ tests/qemuxmlconftest.c | 70 +++++++++++++++++++ 7 files changed, 128 insertions(+) create mode 100644 tests/qemuxmlconfdata/net-user-passt.x86_64-7.2.0.passt= 0.args create mode 100644 tests/qemuxmlconfdata/net-user-passt.x86_64-latest.pass= t0.args create mode 100644 tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest= .passt0.args create mode 100644 tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest= .passt1.args create mode 100644 tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest= .passt2.args create mode 100644 tests/qemuxmlconfdata/schema-reorder-domain-subelements= .x86_64-latest.passt0.args diff --git a/tests/qemuxmlconfdata/net-user-passt.x86_64-7.2.0.passt0.args = b/tests/qemuxmlconfdata/net-user-passt.x86_64-7.2.0.passt0.args new file mode 100644 index 0000000000..b244eb711d --- /dev/null +++ b/tests/qemuxmlconfdata/net-user-passt.x86_64-7.2.0.passt0.args @@ -0,0 +1,13 @@ +passt \ +--one-off \ +--socket /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0.socket \ +--pid /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0-passt.pid \ +--interface eth42 \ +--log-file /var/log/loglaw.blog \ +--address 172.17.2.0 \ +--netmask 24 \ +--address 2001:db8:ac10:fd01::feed \ +--tcp-ports '2001:db8:ac10:fd01::1:10/22:2022,1000-1050,~1020,~1030-1040' \ +--udp-ports '1.2.3.4%eth0/5000-5020:6000-6020,~5010-5015' \ +--tcp-ports 80 \ +--tcp-ports 443:344 diff --git a/tests/qemuxmlconfdata/net-user-passt.x86_64-latest.passt0.args= b/tests/qemuxmlconfdata/net-user-passt.x86_64-latest.passt0.args new file mode 100644 index 0000000000..b244eb711d --- /dev/null +++ b/tests/qemuxmlconfdata/net-user-passt.x86_64-latest.passt0.args @@ -0,0 +1,13 @@ +passt \ +--one-off \ +--socket /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0.socket \ +--pid /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0-passt.pid \ +--interface eth42 \ +--log-file /var/log/loglaw.blog \ +--address 172.17.2.0 \ +--netmask 24 \ +--address 2001:db8:ac10:fd01::feed \ +--tcp-ports '2001:db8:ac10:fd01::1:10/22:2022,1000-1050,~1020,~1030-1040' \ +--udp-ports '1.2.3.4%eth0/5000-5020:6000-6020,~5010-5015' \ +--tcp-ports 80 \ +--tcp-ports 443:344 diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.passt0= .args b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.passt0.args new file mode 100644 index 0000000000..f75fc0749a --- /dev/null +++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.passt0.args @@ -0,0 +1,14 @@ +passt \ +--vhost-user \ +--one-off \ +--socket /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0.socket \ +--pid /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0-passt.pid \ +--interface eth42 \ +--log-file /var/log/loglaw.blog \ +--address 172.17.2.0 \ +--netmask 24 \ +--address 2001:db8:ac10:fd01::feed \ +--tcp-ports '2001:db8:ac10:fd01::1:10/22:2022,1000-1050,~1020,~1030-1040' \ +--udp-ports '1.2.3.4%eth0/5000-5020:6000-6020,~5010-5015' \ +--tcp-ports 80 \ +--tcp-ports 443:344 diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.passt1= .args b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.passt1.args new file mode 100644 index 0000000000..4bebc2bcb1 --- /dev/null +++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.passt1.args @@ -0,0 +1,5 @@ +passt \ +--vhost-user \ +--one-off \ +--socket /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net1.socket \ +--pid /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net1-passt.pid diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.passt2= .args b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.passt2.args new file mode 100644 index 0000000000..35cd30a553 --- /dev/null +++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.passt2.args @@ -0,0 +1,6 @@ +passt \ +--vhost-user \ +--one-off \ +--socket /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net2.socket \ +--pid /var/run/libvirt/qemu/passt/-1-QEMUGuest1-net2-passt.pid \ +--interface eth43 diff --git a/tests/qemuxmlconfdata/schema-reorder-domain-subelements.x86_64= -latest.passt0.args b/tests/qemuxmlconfdata/schema-reorder-domain-subelemen= ts.x86_64-latest.passt0.args new file mode 100644 index 0000000000..59574106e1 --- /dev/null +++ b/tests/qemuxmlconfdata/schema-reorder-domain-subelements.x86_64-latest= .passt0.args @@ -0,0 +1,7 @@ +passt \ +--vhost-user \ +--one-off \ +--socket /var/run/libvirt/qemu/passt/-1-passtvhostuu-net0.socket \ +--pid /var/run/libvirt/qemu/passt/-1-passtvhostuu-net0-passt.pid \ +--address 10.30.0.5 \ +--netmask 24 diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index dea75d805f..7280176de1 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -16,6 +16,7 @@ # include "qemu/qemu_capabilities.h" # include "qemu/qemu_domain.h" # include "qemu/qemu_migration.h" +# include "qemu/qemu_passt.h" # include "qemu/qemu_process.h" # include "qemu/qemu_slirp.h" # include "datatypes.h" @@ -803,6 +804,72 @@ testCompareOutXML2XML(const void *data) } =20 =20 +static int +testExtDeviceArgv(testQemuInfo *info, + virCommand *cmd, + const char *helper, + size_t idx) +{ + g_auto(virBuffer) actualBuf =3D VIR_BUFFER_INITIALIZER; + g_autofree char *actualargv =3D NULL; + g_autofree char *outfile =3D NULL; + virError *err =3D NULL; + + outfile =3D g_strdup_printf("%s/qemuxmlconfdata/%s%s%s.%s%zu.args", + abs_srcdir, info->name, info->suffix, + info->args.capsvariant, helper, idx); + testQemuConfMarkUsed(info, outfile); + + if (!cmd) { + err =3D virGetLastError(); + if (!err) { + VIR_TEST_DEBUG("no error was reported for expected failure"); + return -1; + } + return -1; + } + + if (virCommandToStringBuf(cmd, &actualBuf, true, false) < 0) + return -1; + + virBufferAddLit(&actualBuf, "\n"); + actualargv =3D virBufferContentAndReset(&actualBuf); + + if (virTestCompareToFileFull(actualargv, outfile, false) < 0) + return -1; + + return 0; +} + + +static int +testExtDevicesArgv(testQemuInfo *info, + virDomainObj *vm) +{ + size_t i =3D 42; + int ret =3D 0; + + for (i =3D 0; i < vm->def->nnets; i++) { + virDomainNetDef *net =3D vm->def->nets[i]; + + if (net->type !=3D VIR_DOMAIN_NET_TYPE_USER && + net->type !=3D VIR_DOMAIN_NET_TYPE_VHOSTUSER) { + continue; + } + + if (net->backend.type =3D=3D VIR_DOMAIN_NET_BACKEND_PASST) { + g_autoptr(virCommand) cmd =3D NULL; + + cmd =3D qemuPasstBuildCommand(NULL, NULL, vm, net); + if (testExtDeviceArgv(info, cmd, "passt", i) < 0) + ret =3D -1; + } + } + + return ret; +} + + static int testCompareXMLToArgv(const void *data) { @@ -897,6 +964,9 @@ testCompareXMLToArgv(const void *data) if (virTestCompareToFileFull(actualargv, info->outfile, false) < 0) goto cleanup; =20 + if (testExtDevicesArgv(info, vm) < 0) + goto cleanup; + ret =3D 0; =20 ok: --=20 2.50.1