From nobody Sun Feb 8 21:38:01 2026 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=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 1726646354751934.1773408516001; Wed, 18 Sep 2024 00:59:14 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4D30B171E; Wed, 18 Sep 2024 03:59:09 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A145B1B50; Wed, 18 Sep 2024 03:55:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7C0D21431; Wed, 18 Sep 2024 03:55:40 -0400 (EDT) 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 94DA019AF for ; Wed, 18 Sep 2024 03:55:31 -0400 (EDT) Received: from mx-prod-mc-05.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-564-bMXlNPUjOHa_P_vej5WJ1g-1; Wed, 18 Sep 2024 03:55:29 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D02D51956083 for ; Wed, 18 Sep 2024 07:55:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CE8881955DC6 for ; Wed, 18 Sep 2024 07:55:27 +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.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726646131; 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=BZvUnTlJao4EFGDVOPWJrsVCllwTa36VEymUJX4eYDM=; b=GKcx7vEdMyPm2eJIDgc2LFkU17r3cbMGQHClB69jdrgIx9dBQpIJPGupIFEwmxKwvSHtBT YhPgEFxOgtwtBieM69dT6EUHxYdGqNfzdl+U+V+rNY3fu3K/JAbO4esD0F/oDC1xCh1FGi PTQeOg/wK+r3tgYEZZoV441bpJs0BHs= X-MC-Unique: bMXlNPUjOHa_P_vej5WJ1g-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 5/8] qemuxmlconftest: Add test case for QMP schema validation of -chardev backends Date: Wed, 18 Sep 2024 09:55:15 +0200 Message-ID: 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-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IR244ZFEIYK3VGMSDVR67GTAKV5XYHDL X-Message-ID-Hash: IR244ZFEIYK3VGMSDVR67GTAKV5XYHDL 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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1726646356874116600 Content-Type: text/plain; charset="utf-8" Use the 'chardev-backends' test data as symlink to invoke the test case again asserting QEMU_CAPS_CHARDEV_JSON which will make the commandline generator use the JSON representation of the -chardev backend instead allowing us to validate it agains the QMP schema. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- .../chardev-backends-json.x86_64-latest.args | 79 +++++++++++++++++++ .../chardev-backends-json.x86_64-latest.xml | 1 + .../qemuxmlconfdata/chardev-backends-json.xml | 1 + tests/qemuxmlconftest.c | 4 + 4 files changed, 85 insertions(+) create mode 100644 tests/qemuxmlconfdata/chardev-backends-json.x86_64-late= st.args create mode 120000 tests/qemuxmlconfdata/chardev-backends-json.x86_64-late= st.xml create mode 120000 tests/qemuxmlconfdata/chardev-backends-json.xml diff --git a/tests/qemuxmlconfdata/chardev-backends-json.x86_64-latest.args= b/tests/qemuxmlconfdata/chardev-backends-json.x86_64-latest.args new file mode 100644 index 0000000000..98929ab39f --- /dev/null +++ b/tests/qemuxmlconfdata/chardev-backends-json.x86_64-latest.args @@ -0,0 +1,79 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,acpi= =3Doff \ +-accel tcg \ +-cpu qemu64 \ +-m size=3D219136k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev '{"id":"charmonitor","backend":{"type":"socket","data":{"addr":{"= type":"fd","data":{"str":"1729"}},"server":true,"wait":false}}}' \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-device '{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.0"= ,"addr":"0x3"}' \ +-chardev '{"id":"charparallel0","backend":{"type":"parallel","data":{"devi= ce":"/dev/parport0"}}}' \ +-device '{"driver":"isa-parallel","chardev":"charparallel0","id":"parallel= 0"}' \ +-add-fd set=3D0,fd=3D1751,opaque=3Dchannel0-log \ +-chardev '{"id":"charchannel0","backend":{"type":"null","data":{"logfile":= "/dev/fdset/0","logappend":true}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chard= ev":"charchannel0","id":"channel0","name":"chardev-null"}' \ +-add-fd set=3D1,fd=3D1751,opaque=3Dchannel1-log \ +-chardev '{"id":"charchannel1","backend":{"type":"vc","data":{"logfile":"/= dev/fdset/1","logappend":true}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":2,"chard= ev":"charchannel1","id":"channel1","name":"chardev-vc"}' \ +-chardev '{"id":"charchannel2","backend":{"type":"pty","data":{}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":3,"chard= ev":"charchannel2","id":"channel2","name":"chardev-pty"}' \ +-chardev '{"id":"charchannel3","backend":{"type":"stdio","data":{}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":4,"chard= ev":"charchannel3","id":"channel3","name":"chardev-stdio"}' \ +-add-fd set=3D2,fd=3D1750,opaque=3Dchannel4-source \ +-chardev '{"id":"charchannel4","backend":{"type":"file","data":{"out":"/de= v/fdset/2","append":true}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":5,"chard= ev":"charchannel4","id":"channel4","name":"chardev-file"}' \ +-chardev '{"id":"charchannel5","backend":{"type":"pipe","data":{"device":"= /path/to/pipe"}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":6,"chard= ev":"charchannel5","id":"channel5","name":"chardev-pipe"}' \ +-chardev '{"id":"charchannel6","backend":{"type":"serial","data":{"device"= :"/path/to/device"}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":7,"chard= ev":"charchannel6","id":"channel6","name":"chardev-dev"}' \ +-chardev '{"id":"charchannel7","backend":{"type":"socket","data":{"addr":{= "type":"fd","data":{"str":"1729"}},"server":true,"wait":false}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":8,"chard= ev":"charchannel7","id":"channel7","name":"chardev-unix-listen"}' \ +-chardev '{"id":"charchannel8","backend":{"type":"socket","data":{"addr":{= "type":"unix","data":{"path":"/path/to/unix-listen"}},"server":false,"recon= nect":2}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":9,"chard= ev":"charchannel8","id":"channel8","name":"chardev-unix-connect"}' \ +-chardev '{"id":"charchannel9","backend":{"type":"socket","data":{"addr":{= "type":"inet","data":{"host":"1.2.3.4","port":"5678"}},"telnet":false,"serv= er":true,"wait":false}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":10,"char= dev":"charchannel9","id":"channel9","name":"chardev-tcp-listen-raw"}' \ +-chardev '{"id":"charchannel10","backend":{"type":"socket","data":{"addr":= {"type":"inet","data":{"host":"1.2.3.4","port":"5679"}},"telnet":true,"serv= er":true,"wait":false}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":11,"char= dev":"charchannel10","id":"channel10","name":"chardev-tcp-listen-telnet"}' \ +-object '{"qom-type":"tls-creds-x509","id":"objcharchannel11_tls0","dir":"= /etc/pki/libvirt-chardev","endpoint":"client","verify-peer":true}' \ +-chardev '{"id":"charchannel11","backend":{"type":"socket","data":{"addr":= {"type":"inet","data":{"host":"1.2.3.4","port":"5678"}},"telnet":false,"ser= ver":false,"reconnect":2,"tls-creds":"objcharchannel11_tls0"}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":12,"char= dev":"charchannel11","id":"channel11","name":"chardev-tcp-connect-raw"}' \ +-object '{"qom-type":"tls-creds-x509","id":"objcharchannel12_tls0","dir":"= /etc/pki/libvirt-chardev","endpoint":"client","verify-peer":true}' \ +-chardev '{"id":"charchannel12","backend":{"type":"socket","data":{"addr":= {"type":"inet","data":{"host":"hostname.global.","port":"5679"}},"telnet":t= rue,"server":false,"reconnect":2,"tls-creds":"objcharchannel12_tls0"}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":13,"char= dev":"charchannel12","id":"channel12","name":"chardev-tcp-connect-telnet"}'= \ +-chardev '{"id":"charchannel13","backend":{"type":"udp","data":{"remote":{= "type":"inet","data":{"host":"127.0.0.1","port":"2222"}}}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":14,"char= dev":"charchannel13","id":"channel13","name":"chardev-udp-nobind"}' \ +-chardev '{"id":"charchannel14","backend":{"type":"udp","data":{"remote":{= "type":"inet","data":{"host":"127.0.0.1","port":"2222"}},"local":{"type":"i= net","data":{"host":"127.0.0.1","port":"1111"}}}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":15,"char= dev":"charchannel14","id":"channel14","name":"chardev-udp-bind"}' \ +-chardev '{"id":"charchannel15","backend":{"type":"spicevmc","data":{"type= ":"vdagent"}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":16,"char= dev":"charchannel15","id":"channel15","name":"com.redhat.spice.0"}' \ +-chardev '{"id":"charchannel16","backend":{"type":"qemu-vdagent","data":{"= clipboard":false,"mouse":false}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":17,"char= dev":"charchannel16","id":"channel16","name":"chardev-vdagent"}' \ +-chardev '{"id":"charchannel17","backend":{"type":"dbus","data":{"name":"t= est.channel.0"}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":18,"char= dev":"charchannel17","id":"channel17","name":"chardev-dbus"}' \ +-chardev '{"id":"charchannel18","backend":{"type":"spiceport","data":{"fqd= n":"test.channel.0"}}}' \ +-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":19,"char= dev":"charchannel18","id":"channel18","name":"chardev-spiceport"}' \ +-audiodev '{"id":"audio1","driver":"spice"}' \ +-spice port=3D5901,addr=3D0.0.0.0,seamless-migration=3Don \ +-device '{"driver":"cirrus-vga","id":"video0","bus":"pci.0","addr":"0x2"}'= \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/chardev-backends-json.x86_64-latest.xml = b/tests/qemuxmlconfdata/chardev-backends-json.x86_64-latest.xml new file mode 120000 index 0000000000..39fa243d0a --- /dev/null +++ b/tests/qemuxmlconfdata/chardev-backends-json.x86_64-latest.xml @@ -0,0 +1 @@ +chardev-backends.x86_64-latest.xml \ No newline at end of file diff --git a/tests/qemuxmlconfdata/chardev-backends-json.xml b/tests/qemuxm= lconfdata/chardev-backends-json.xml new file mode 120000 index 0000000000..b6ebea2ae3 --- /dev/null +++ b/tests/qemuxmlconfdata/chardev-backends-json.xml @@ -0,0 +1 @@ +chardev-backends.xml \ No newline at end of file diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 914326bc3c..08dc8a10e3 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -1832,6 +1832,10 @@ mymain(void) DO_TEST_CAPS_LATEST("console-compat-crash"); DO_TEST_CAPS_LATEST("chardev-backends"); + /* As qemu doesn't yet support JSON syntax for -chardev we use the + * QEMU_CAPS_CHARDEV_JSON capability just in the tests to have QMP sch= ema + * validation also for the QMP mode of the -chardev props generator */ + DO_TEST_CAPS_ARCH_LATEST_FULL("chardev-backends-json", "x86_64", ARG_Q= EMU_CAPS, QEMU_CAPS_CHARDEV_JSON, QEMU_CAPS_LAST); DO_TEST_CAPS_LATEST("serial-vc-chardev"); DO_TEST_CAPS_LATEST("serial-pty-chardev"); --=20 2.46.0