From nobody Sun Feb 8 19:56:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1593701207; cv=none; d=zohomail.com; s=zohoarc; b=Cohfc8ggvMsUgkvW0/BqMK00QXv87M2/dsQGJmIUI610EK0li7eBy4zhv1PlsN37Wd/hP/doR6Bd1MuGynKfHxeYU3ABzHCKvLsh8Fr1fYTa17qt7uiS4L4SGz2DG7syxMBWnafEmOYFyv/y5Ulv3j0+PT84uzERf/o+LGftiz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593701207; 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=ZlpRpMzMOuUXG3MSgCaLwr3/G7J+OBv2RwxRpyuF3Ys=; b=R2k+iVAx8FOBxv5YS3fV74ZeAJ4uizNGhhrkNVwc/WLeNroAHmVbV41CCjsfGci0znyaHOKZYSjakM0+b5ZiBeYRg3QmM41yVr/u+GRnCs41JZpUc1Wh81B/i7xR3YgfoGAZBf42QmRy6bquJTjO1yfms3kWxZs2oX7dXgW0UIk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1593701207838538.5767336427539; Thu, 2 Jul 2020 07:46:47 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-274-W6MGtetAMjWvrTkUaDKXzA-1; Thu, 02 Jul 2020 10:46:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E45D87951B; Thu, 2 Jul 2020 14:46:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF122778A4; Thu, 2 Jul 2020 14:46:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BC1E51809547; Thu, 2 Jul 2020 14:46:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 062Eebxu011885 for ; Thu, 2 Jul 2020 10:40:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id C815E10002A2; Thu, 2 Jul 2020 14:40:37 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4449E10013D2 for ; Thu, 2 Jul 2020 14:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593701206; 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=ZlpRpMzMOuUXG3MSgCaLwr3/G7J+OBv2RwxRpyuF3Ys=; b=Fakg24O0IwRCvMcc5NrRHuAKgxDmfCGrTM0TE/v4goWRl2sJOP2ie5yey1UU3p/f7kyQFH u9cWyCxBgJ3fa3Nf15TqvrhZm4ll+jzudcfRr4zt1YSSyA8wbKKVdy+rhjyjWZj3N5hvUr qyOdmgVKvtWggMgXaS71GAAZl0hQPvw= X-MC-Unique: W6MGtetAMjWvrTkUaDKXzA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 20/24] testCompareBackupXML: Add infrastructure for testing internal fields Date: Thu, 2 Jul 2020 16:40:06 +0200 Message-Id: <2dfb9013dcbc8f7415b779acf26e4af34f51a764.1593700474.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" There are few internal fields of the backup XML. Propagate the 'internal' flag so that the test can verify the XML infrastructure. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/genericxml2xmltest.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 74e520522b..cf07f9bb79 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -45,16 +45,27 @@ testCompareXMLToXMLHelper(const void *data) } +struct testCompareBackupXMLData { + const char *testname; + bool internal; +}; + + static int -testCompareBackupXML(const void *data) +testCompareBackupXML(const void *opaque) { - const char *testname =3D data; + const struct testCompareBackupXMLData *data =3D opaque; + const char *testname =3D data->testname; g_autofree char *xml_in =3D NULL; g_autofree char *file_in =3D NULL; g_autofree char *file_out =3D NULL; g_autoptr(virDomainBackupDef) backup =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; g_autofree char *actual =3D NULL; + unsigned int parseFlags =3D 0; + + if (data->internal) + parseFlags |=3D VIR_DOMAIN_BACKUP_PARSE_INTERNAL; file_in =3D g_strdup_printf("%s/domainbackupxml2xmlin/%s.xml", abs_srcdir, testname); @@ -64,12 +75,12 @@ testCompareBackupXML(const void *data) if (virFileReadAll(file_in, 1024 * 64, &xml_in) < 0) return -1; - if (!(backup =3D virDomainBackupDefParseString(xml_in, xmlopt, 0))) { + if (!(backup =3D virDomainBackupDefParseString(xml_in, xmlopt, parseFl= ags))) { VIR_TEST_VERBOSE("failed to parse backup def '%s'", file_in); return -1; } - if (virDomainBackupDefFormat(&buf, backup, false) < 0) { + if (virDomainBackupDefFormat(&buf, backup, data->internal) < 0) { VIR_TEST_VERBOSE("failed to format backup def '%s'", file_in); return -1; } @@ -185,9 +196,16 @@ mymain(void) DO_TEST_DIFFERENT("cputune"); +#define DO_TEST_BACKUP_FULL(name, intrnl) \ + do { \ + const struct testCompareBackupXMLData data =3D { .testname =3D nam= e, \ + .internal =3D intrn= l }; \ + if (virTestRun("QEMU BACKUP XML-2-XML " name, testCompareBackupXML= , &data) < 0) \ + ret =3D -1; \ + } while (false) + #define DO_TEST_BACKUP(name) \ - if (virTestRun("QEMU BACKUP XML-2-XML " name, testCompareBackupXML, na= me) < 0) \ - ret =3D -1; + DO_TEST_BACKUP_FULL(name, false) DO_TEST_BACKUP("empty"); DO_TEST_BACKUP("backup-pull"); --=20 2.26.2