From nobody Fri Dec 19 22:06:11 2025 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=1679065000; cv=none; d=zohomail.com; s=zohoarc; b=KUnhdLZD8aqFJLJopeB4l2mvPIyF0NWV0tCZzuETScNLW8RgG3RzFh9Puun5jxt15H3orTzP4ctlxD94BROl3GvOyspODiW/X7njH6V3XfFPkrSmwakKaV22zmwKemW23a6etStoeaoHhw8GRHPxbZsl4lT8A72iWkgpD5fkpGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679065000; 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=wJ7p+QYrDo5OLs2r0G+YWN/8vjvwIWgGlCNnY0vhmaw=; b=m/YMQuhx8bbdvP2eGai2urtErUkIbWV9zxmmPQR6vWyPrUCrwimwHum/5eXXz37Xm1tDOFSe9M63atVERqmi51+cFWNfbfKWVdu2Ul5dWA71LfsQJrse3uXQYdbv/1VWDoLY3u/2XM7ZPDktNaO2ry4Q28gU9xx1XXNGgLqjuMU= 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 1679065000520630.5229057802868; Fri, 17 Mar 2023 07:56:40 -0700 (PDT) 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-375-T0FB9xS9NkOc2ZkyBivQ3w-1; Fri, 17 Mar 2023 10:56:35 -0400 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 A89353847086; Fri, 17 Mar 2023 14:56:31 +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 947CB1410F1C; Fri, 17 Mar 2023 14:56:31 +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 5273A1946A40; Fri, 17 Mar 2023 14:56:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B5F2A1946587 for ; Thu, 16 Mar 2023 16:12:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 960652166B2B; Thu, 16 Mar 2023 16:12:15 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE51A2166B29 for ; Thu, 16 Mar 2023 16:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679064999; 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=wJ7p+QYrDo5OLs2r0G+YWN/8vjvwIWgGlCNnY0vhmaw=; b=BbJ56jPe6Q2gM2TGDImTPoSej2ivBHZjxvdsgRc/pOEfoU9jq3ljmjYMfNxvh4VBB2Zp5F LMpqDrFtSl/SWVNqJvGGxsU4anGZdNv7xNGO1JpJW/5b5qKBvGRh/IjKXJa+vqg1yLB30V fVQfSW8JOsZdaBniVAWD8BRjYLREwhU= X-MC-Unique: T0FB9xS9NkOc2ZkyBivQ3w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/24] tests: qemucapabilitiesdata: Add README file Date: Thu, 16 Mar 2023 17:11:37 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1679065002236100003 Content-Type: text/plain; charset="utf-8" Explain what the purpose of these files is as well as how they are named, captured, used and modified. Signed-off-by: Peter Krempa --- tests/qemucapabilitiesdata/README.rst | 94 +++++++++++++++++++++++++++ tests/qemucapabilitiestest.c | 18 +---- 2 files changed, 95 insertions(+), 17 deletions(-) create mode 100644 tests/qemucapabilitiesdata/README.rst diff --git a/tests/qemucapabilitiesdata/README.rst b/tests/qemucapabilities= data/README.rst new file mode 100644 index 0000000000..0bf6c97284 --- /dev/null +++ b/tests/qemucapabilitiesdata/README.rst @@ -0,0 +1,94 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D +QEMU capabilities testing +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D + +Purpose +=3D=3D=3D=3D=3D=3D=3D + +The test data is used to excercise the capability parsing code in +``qemucapabilitiestest`` but also provides "real" capabilities data for te= st +suites such as ``domaincapstest`` and ``qemuxml2(argv|xml)test``. + +It also provides the required data to validate the QMP commands used by li= bvirt +against qemu's QMP schema. + +Naming +=3D=3D=3D=3D=3D=3D + +Files in this directory have the following naming scheme:: + + caps_$QEMUVERSION_$ARCHITECTURE.$SUFFIX + +``$QEMUVERSION`` + + Numeric representation of the qemu version, e.g.: ``7.0.0`` + +``$ARCHITECTURE`` + + Architecture string such as ``x86_64``, ``aarch64``, etc. + +``$SUFFIX`` + + ``.replies`` for the dump of the QMP communication used to probe qemu. + ``.xml`` for the generated capability dump + +Usage in tests +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Testsuites such as ``qemucapabilitiestest`` or ``domaincapstest`` pick up = the +test data automatically once the corresponding ``.xml`` or ``.replies`` fi= le +is present in ``tests/qemucapabilitiesdata``. + +Other test suites such as ``qemuxml2argvtest`` provide macros which invoke= test +cases using this data such as ``DO_TEST_CAPS_LATEST``. + +Capturing QEMU capabilities +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D + +QEMU capabilities are captured by running the ``qemucapsprobe`` on the QEMU +binary on given architecture and then capturing the output. Since virtuali= zation +acceleration is also probed it's required to run it on real hardware. + +The capabilities dumps contain also host-specific information such as the = exact +CPU definition of the machine where it was ran on, thus they can differ +significantly when run on other machines. + +Probing QEMU +------------ + +Run the ``qemucapsrpobe`` tool:: + + $ LIBVIRT_BUILDDIR/tests/qemucapsprobe /path/to/qemu > output.replies + +The tool spawns the qemu binary and performs probing as if libvirt would d= o that. +The QMP conversation between qemu and libvirt is dumped to stdout. User +running the probe must be able to access the virtualization accelerator (e= .g. +have proper permissions on ``/dev/kvm``) + +Generating the output files +--------------------------- + +Place the captured output ``.replies`` file into this directory and run:: + + $ VIR_TEST_REGENERATE_OUTPUT=3D1 ninja test + +This runs the test-suite instructing it to update and/or generate all new = data +the test would normally expect. + +Manual modifications the ``.replies`` file +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +In certain cases it's impractical or impossible to re-generate the ``.repl= ies`` +file on a code change causing a change to the actual QMP query process. + +In such case a careful manual modification of the ``.repliess`` is tolerat= ed. + +To aid such modification the tool ``tests/qemucapabilitiesnumbering`` can = be +used. + +The tool validates and updates the numbering of the entres in the QMP dump= in +case something was modified. + +The tool also allows programatic modification of the ``.replies`` file. + +See ``tests/qemucapabilitiesnumbering.c``. diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index 8c86095e1c..379fe427d8 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -206,23 +206,7 @@ mymain(void) if (testQemuCapsIterate(".replies", doCapsTest, &data) < 0) return EXIT_FAILURE; - /* - * Run "tests/qemucapsprobe /path/to/qemu/binary >foo.replies" - * to generate updated or new *.replies data files. - * - * If you manually edit replies files you can run - * VIR_TEST_REGENERATE_OUTPUT=3D1 tests/qemucapabilitiesnumbering - * to fix the replies ids. The tool also allows for programmatic - * modification of the replies file. - * - * Once a replies file has been generated and tweaked if necessary, - * you can drop it into tests/qemucapabilitiesdata/ (with a sensible - * name - look at what's already there for inspiration) and test - * programs will automatically pick it up. - * - * To generate the corresponding output files after a new replies - * file has been added, run "VIR_TEST_REGENERATE_OUTPUT=3D1 ninja test= ". - */ + /* See documentation in qemucapabilitiesdata/README.rst */ testQemuDataReset(&data); --=20 2.39.2