From nobody Sun Feb 8 20:23:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1626792273; cv=none; d=zohomail.com; s=zohoarc; b=RHw++hphah+C0k8RL+EtOZWcTG71Lf3M9rO4TFN8tdkjfZZc1Mt2AX2rAhXlpJwfPQAD2iCmLyxsX2hQuezGGtPT5ePypffLnhoE0X0+lvBUdTtFN2P0PvTqOte43r8aNByYdC2PFT0g6nlC6On9kw0Rp1R5WqGYvfw9/uKUazY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626792273; 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=BBM5RhXqHKl2jtw+TNbrEGxltZjJ2PwqMlhQbR51PYw=; b=H86QoDaqno6MR5CcyCNXr+aqpjoBPpq1tovzG5ntmOzTuRrvPvr0/qS3CZOhThlgUXKcBy5WbxDO0js8SDGcYz8uXmzjhhe2/gnU4Nt0pG61QJoeDz3BAGRwMFdRN8Gbf7vhaIifPnQb+g/Rga7AO0IKNCrvlilHcsSVW1KrPuU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 162679227332448.148837060934966; Tue, 20 Jul 2021 07:44:33 -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-597-0C9yG-6bMbCA-uE_G06dng-1; Tue, 20 Jul 2021 10:44:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B05E58030D2; Tue, 20 Jul 2021 14:44:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B2F5C10023B0; Tue, 20 Jul 2021 14:44:23 +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 1A05C4EA2A; Tue, 20 Jul 2021 14:44:23 +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 16KEiLvR006077 for ; Tue, 20 Jul 2021 10:44:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id DB17710074E1; Tue, 20 Jul 2021 14:44:21 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66A3B10023B0 for ; Tue, 20 Jul 2021 14:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626792272; 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=BBM5RhXqHKl2jtw+TNbrEGxltZjJ2PwqMlhQbR51PYw=; b=TDSLP/ZxkUhRWLRf6EEtHHrS9ohtWDovuZijqrcfgTcE7lBbvc5GSGugF9H01Tzvbuj/FT hfG51AAR2tf7Z4Mk3uOQyp9Oq34ayUv0IpgfC5DKfG0NJKXR//E+TGmvFqFBonp29zacHW EGwdMCYm4hWWfZq66o0epiXgaJQJQr8= X-MC-Unique: 0C9yG-6bMbCA-uE_G06dng-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 2/2] genericxml2xmltest: Refactor DO_TEST_FULL() calls Date: Tue, 20 Jul 2021 16:44:08 +0200 Message-Id: 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.84 on 10.5.11.22 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) X-ZM-MESSAGEID: 1626792274261100002 Content-Type: text/plain; charset="utf-8" I have added 2 new macros to call tests which are expected to fail in order to make the code more consistent and readable. Signed-off-by: Kristina Hanicova --- tests/genericxml2xmltest.c | 63 +++++++++++++++----------------------- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 3d5534ab54..7cf70203d7 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -153,6 +153,12 @@ mymain(void) #define DO_TEST_DIFFERENT(name) \ DO_TEST_FULL(name, 1, true, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) =20 +#define DO_TEST_FAIL_ACTIVE(name) \ + DO_TEST_FULL(name, 0, true, TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE) + +#define DO_TEST_FAIL_INACTIVE(name) \ + DO_TEST_FULL(name, 0, false, TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARS= E) + DO_TEST_DIFFERENT("disk-virtio"); DO_TEST_DIFFERENT("disk-hyperv-physical"); DO_TEST_DIFFERENT("disk-hyperv-virtual"); @@ -162,19 +168,16 @@ mymain(void) DO_TEST_DIFFERENT("graphics-vnc-socket"); DO_TEST_DIFFERENT("graphics-vnc-socket-listen"); DO_TEST_DIFFERENT("graphics-listen-back-compat"); - DO_TEST_FULL("graphics-listen-back-compat-mismatch", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FAIL_ACTIVE("graphics-listen-back-compat-mismatch"); DO_TEST_DIFFERENT("graphics-vnc-listen-attr-only"); DO_TEST_DIFFERENT("graphics-vnc-listen-element-minimal"); DO_TEST_DIFFERENT("graphics-vnc-listen-element-with-address"); DO_TEST_DIFFERENT("graphics-vnc-socket-attr-listen-address"); DO_TEST_DIFFERENT("graphics-vnc-socket-attr-listen-socket"); - DO_TEST_FULL("graphics-vnc-socket-attr-listen-socket-mismatch", 0, tru= e, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FAIL_ACTIVE("graphics-vnc-socket-attr-listen-socket-mismatch"); DO_TEST("graphics-vnc-autoport-no"); =20 - DO_TEST_FULL("name-slash-fail", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FAIL_ACTIVE("name-slash-fail"); =20 DO_TEST("perf"); =20 @@ -188,47 +191,31 @@ mymain(void) DO_TEST("network-interface-mac-check"); =20 DO_TEST_DIFFERENT("chardev-tcp"); - DO_TEST_FULL("chardev-tcp-missing-host", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("chardev-tcp-missing-service", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("chardev-tcp-multiple-source", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FAIL_ACTIVE("chardev-tcp-missing-host"); + DO_TEST_FAIL_ACTIVE("chardev-tcp-missing-service"); + DO_TEST_FAIL_ACTIVE("chardev-tcp-multiple-source"); DO_TEST_DIFFERENT("chardev-udp"); - DO_TEST_FULL("chardev-udp-missing-connect-service", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("chardev-udp-multiple-source", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FAIL_ACTIVE("chardev-udp-missing-connect-service"); + DO_TEST_FAIL_ACTIVE("chardev-udp-multiple-source"); DO_TEST_DIFFERENT("chardev-unix"); - DO_TEST_FULL("chardev-unix-smartcard-missing-path", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("chardev-unix-redirdev-missing-path", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("chardev-unix-rng-missing-path", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FAIL_ACTIVE("chardev-unix-smartcard-missing-path"); + DO_TEST_FAIL_ACTIVE("chardev-unix-redirdev-missing-path"); + DO_TEST_FAIL_ACTIVE("chardev-unix-rng-missing-path"); DO_TEST_DIFFERENT("chardev-reconnect"); - DO_TEST_FULL("chardev-reconnect-missing-timeout", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("chardev-reconnect-invalid-mode", 0, true, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FAIL_ACTIVE("chardev-reconnect-missing-timeout"); + DO_TEST_FAIL_ACTIVE("chardev-reconnect-invalid-mode"); =20 DO_TEST("cachetune-small"); DO_TEST("cachetune-cdp"); DO_TEST_DIFFERENT("cachetune"); DO_TEST_DIFFERENT("cachetune-extra-tunes"); - DO_TEST_FULL("cachetune-colliding-allocs", false, false, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("cachetune-colliding-tunes", false, false, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("cachetune-colliding-types", false, false, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("cachetune-colliding-monitor", false, false, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FAIL_INACTIVE("cachetune-colliding-allocs"); + DO_TEST_FAIL_INACTIVE("cachetune-colliding-tunes"); + DO_TEST_FAIL_INACTIVE("cachetune-colliding-types"); + DO_TEST_FAIL_INACTIVE("cachetune-colliding-monitor"); DO_TEST_DIFFERENT("memorytune"); - DO_TEST_FULL("memorytune-colliding-allocs", false, false, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); - DO_TEST_FULL("memorytune-colliding-cachetune", false, false, - TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FAIL_INACTIVE("memorytune-colliding-allocs"); + DO_TEST_FAIL_INACTIVE("memorytune-colliding-cachetune"); =20 DO_TEST("tseg"); =20 --=20 2.31.1