From nobody Tue Nov 26 11:42:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1574161758; cv=none; d=zoho.com; s=zohoarc; b=F6dOvpElLs8MB/nUW+JIl86CJhOQQQ8xG/egLIC+BKO6E019Fv3CKZpK70aN2jPBUT9sPqWuotTxdk/6nkMFFK72iMTrbo2J9ZhIYdKdtFzZG5CXadLcpCPzPK3uqtqzAuY+fk+LXHfDVJmjXFRkNMpQQ0L8jUZWuhW/MAzG4tI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574161758; 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=LQ4g9JYzXVHA8agnIxZYdE4UF24Ny8gPVDmx4g2+g5g=; b=knvoGZAzsd8H8430iauyOYLTq/q09LxHquDwrplvAofQgSduk0zTFp3v+cRWjZQ7uJ5MeD3nuCyQc5LOApm/MU3zQdK4CxovAp78Ol6ilpHrOtyuX/8H/Z8jjhwgThkpVIyENPcENkI2zFhB2cxOGg1ZpbaDrsq1wS7Zv3UnV/o= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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 1574161758126348.50017597166175; Tue, 19 Nov 2019 03:09:18 -0800 (PST) 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-144-nxIV9RmKPma_WO71qKbrsg-1; Tue, 19 Nov 2019 06:09:15 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 669F71883524; Tue, 19 Nov 2019 11:09:10 +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 3EF3C46E67; Tue, 19 Nov 2019 11:09:10 +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 EC3184E56C; Tue, 19 Nov 2019 11:09:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAJB8pkx021153 for ; Tue, 19 Nov 2019 06:08:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4C3EB9302; Tue, 19 Nov 2019 11:08:51 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA80A2935D for ; Tue, 19 Nov 2019 11:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574161757; 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=LQ4g9JYzXVHA8agnIxZYdE4UF24Ny8gPVDmx4g2+g5g=; b=PKQJmv4Q2pwQUNSS2KbFGq7iHw6b0U6A0QQpkGobTWe/Wy+CCdhSdYnI1Tx3z+6Ezzy++K 0ymI1WVe7Hn0tsGJouNBVAUfoktooyde4VycndIjIu2psHpJaZDqZACiCy7X3n1cei0fy3 N3sxjWiUDeTZgCwQh9GiaEd64KIzXEY= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 19 Nov 2019 12:08:44 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] tests: schema: Simplify memory handling using g_autofree 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.15 X-MC-Unique: nxIV9RmKPma_WO71qKbrsg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Refactor various functions to avoid multiple freeing function calls. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- tests/virschematest.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/tests/virschematest.c b/tests/virschematest.c index 5d092d8c8e..8a2322b3bd 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -72,8 +72,6 @@ testSchemaDir(const char *schema, struct dirent *ent; int ret =3D 0; int rc; - char *test_name =3D NULL; - char *xml_path =3D NULL; struct testSchemaData data =3D { .validator =3D validator, }; @@ -82,6 +80,9 @@ testSchemaDir(const char *schema, return -1; while ((rc =3D virDirRead(dir, &ent, dir_path)) > 0) { + g_autofree char *test_name =3D NULL; + g_autofree char *xml_path =3D NULL; + if (!virStringHasSuffix(ent->d_name, ".xml")) continue; if (ent->d_name[0] =3D=3D '.') @@ -94,16 +95,11 @@ testSchemaDir(const char *schema, data.xml_path =3D xml_path; if (virTestRun(test_name, testSchemaFile, &data) < 0) ret =3D -1; - - VIR_FREE(test_name); - VIR_FREE(xml_path); } if (rc < 0) ret =3D -1; - VIR_FREE(test_name); - VIR_FREE(xml_path); VIR_DIR_CLOSE(dir); return ret; } @@ -114,19 +110,16 @@ testSchemaDirs(const char *schema, virXMLValidatorPtr= validator, ...) { va_list args; int ret =3D 0; - char *dir_path =3D NULL; const char *dir; va_start(args, validator); while ((dir =3D va_arg(args, char *))) { - dir_path =3D g_strdup_printf("%s/%s", abs_srcdir, dir); + g_autofree char *dir_path =3D g_strdup_printf("%s/%s", abs_srcdir,= dir); if (testSchemaDir(schema, validator, dir_path) < 0) ret =3D -1; - VIR_FREE(dir_path); } - VIR_FREE(dir_path); va_end(args); return ret; } @@ -136,20 +129,15 @@ static int testSchemaGrammar(const void *opaque) { struct testSchemaData *data =3D (struct testSchemaData *) opaque; - char *schema_path; - int ret =3D -1; + g_autofree char *schema_path =3D NULL; schema_path =3D g_strdup_printf("%s/docs/schemas/%s", abs_top_srcdir, data->schema); if (!(data->validator =3D virXMLValidatorInit(schema_path))) - goto cleanup; - - ret =3D 0; + return -1; - cleanup: - VIR_FREE(schema_path); - return ret; + return 0; } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 11:42:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1574161762; cv=none; d=zoho.com; s=zohoarc; b=YGOJyiKk5mhyCoV7c15ugrw1kTwyOOEeq8c1PPYMBn9HFb045yvzl5rmwtrJjk0ghqsjudEopEgc0r5AzuW0ewX4Kc6c1aVB0KL0meysV2z3H5Pn6SAsqWO0H5zaT3xwl8yQ+KsX0wzBRktG7nJB8FGanyCBvuscWHUVY5kKDds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574161762; 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=Gwvs4wa8kQoT3FPsG03TLQf1ZUzKQkGklRKocSOIiSY=; b=D1Xce7p4wY+Jt1NBcDn7wmSkjan0Zv4hA1vsY43bijgO/c4oMH8yaMwObnIrjSeOvaxhZbcg3ihD1SLhz4D7073cGmNC5p3FTR4bLWBHXmGkYfrsw6W/Y74fcxr76GT4cZqESLyTG+d/1q4IoCu7o4/sd3D0S5YBVeuIXMaDtBs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1574161762377370.6312859717791; Tue, 19 Nov 2019 03:09:22 -0800 (PST) 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-172-8RDbeQy4MqmfV_RoqLuMow-1; Tue, 19 Nov 2019 06:09:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52304801E76; Tue, 19 Nov 2019 11:09:14 +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 2A4FB46E67; Tue, 19 Nov 2019 11:09:14 +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 D870E1808878; Tue, 19 Nov 2019 11:09:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAJB8qa0021158 for ; Tue, 19 Nov 2019 06:08:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 191812935D; Tue, 19 Nov 2019 11:08:52 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97F0B2935A for ; Tue, 19 Nov 2019 11:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574161761; 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=Gwvs4wa8kQoT3FPsG03TLQf1ZUzKQkGklRKocSOIiSY=; b=QECVthxsf54BlsRKO4J7SyDr+84T/Fm0vQTxei5AJIuhNMBTU56+kp5DCxhJ+lZg+zpDOA a9dDeFGvLKO00MYo/E/oGVYaf7S//IGHMrWeesJA1TAr6zkp/9Lho4Srhr4/+0xwqGqxIX cT6nWbDoi9P+KGWEoHyd7FHcMC1lxq4= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 19 Nov 2019 12:08:45 +0100 Message-Id: <0bb889a2aa1a0e79308ed092025b7f6fa5a801b0.1574161682.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] tests: utils: Introduce helper for dispatching libvirt errors 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.15 X-MC-Unique: 8RDbeQy4MqmfV_RoqLuMow-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In cases when we call a libvirt helper which reports an error the error would be hidden unless libvirt library debug is on. This produces a lot of output and is hard to debug. The helper provides a way to dispatch the libvirt error in specific cases sice we do already dispatch it in case when virTestRun is used. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- tests/testutils.c | 29 +++++++++++++++++++++++++---- tests/testutils.h | 1 + 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index f5d8487736..d9c0d5abbe 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -81,6 +81,30 @@ virTestGetFlag(const char *name) } +/** + * virTestPropagateLibvirtError: + * + * In cases when a libvirt utility function which reports libvirt errors is + * used in the test suite outside of the virTestRun call and the failure o= f such + * a function would cause an test failure the error message reported by th= at + * function will not be propagated to the user as the error callback is not + * invoked. + * + * In cases when the error message may be beneficial in debugging this hel= per + * provides means to dispatch the errors including invocation of the error + * callback. + */ +void +virTestPropagateLibvirtError(void) +{ + if (virGetLastErrorCode() =3D=3D VIR_ERR_OK) + return; + + if (virTestGetVerbose() || virTestGetDebug()) + virDispatchError(NULL); +} + + /* * Runs test * @@ -112,10 +136,7 @@ virTestRun(const char *title, virResetLastError(); ret =3D body(data); - if (virGetLastErrorCode()) { - if (virTestGetVerbose() || virTestGetDebug()) - virDispatchError(NULL); - } + virTestPropagateLibvirtError(); if (virTestGetVerbose()) { if (ret =3D=3D 0) diff --git a/tests/testutils.h b/tests/testutils.h index 0088251dca..76090c5522 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -84,6 +84,7 @@ unsigned int virTestGetDebug(void); unsigned int virTestGetVerbose(void); unsigned int virTestGetExpensive(void); unsigned int virTestGetRegenerate(void); +void virTestPropagateLibvirtError(void); #define VIR_TEST_DEBUG(fmt, ...) \ do { \ --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 11:42:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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=1574161746; cv=none; d=zoho.com; s=zohoarc; b=Ltdt+V6VOpP4on+a5R3SnJHO+gjUE9EABd/gpIhHGsZnh/tcqbqjb3imz1ceIwazYg24zgIFnFNWNnfduj3ifSBaAE4zd27MjxXn+t4h5ym4Qm1DJLhiKIu/5jPdKDx3kPzgv8qe6jYAZ4Ku2DzuMPYwNpvP9mH5G5yNabYPODU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574161746; 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=/C4uhNKVx6gf0LbsJHOsbJZeIfT06F6B36302xaStFk=; b=btkW2B0zn7x8tUfhwPzSdj36o2rwWuFzq3/v/sEZTF8DSalBcsnJ5GiV3vkyMNvsZxbBOzH9QVVT31M4qL1HkFZrGW2PLpFkxyOmRHRmCUufr42KJLxs87yUYAe6ceoB2pvsd4Bc5vWDfj1SIgqBBietMU06hEzbMO+XMAl2Vns= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1574161746330603.1749207924607; Tue, 19 Nov 2019 03:09:06 -0800 (PST) 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-155-Nz9swws8NhWmpMADWzDTjg-1; Tue, 19 Nov 2019 06:09:03 -0500 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 26439801FCB; Tue, 19 Nov 2019 11:08:57 +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 BB90810375D5; Tue, 19 Nov 2019 11:08:56 +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 D8BA94BB5B; Tue, 19 Nov 2019 11:08:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAJB8qFU021166 for ; Tue, 19 Nov 2019 06:08:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id DA2332935C; Tue, 19 Nov 2019 11:08:52 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64E6A2935A for ; Tue, 19 Nov 2019 11:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574161745; 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=/C4uhNKVx6gf0LbsJHOsbJZeIfT06F6B36302xaStFk=; b=aKRU+g1cAanMA+4N65LSYDz/XZm5g52jfZ3UsJsg0w2skstBo25aHljYAt0TsqHlhmwUh9 5yxKSBaj4S/kHx4h2aFBx3G0LlVREhK64lCz8s9vAcX8xEOnoMNL9merE6VqWVR8aDznTn dKUaBfyQqFerk0XWEkHCE+FNluMzmo0= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 19 Nov 2019 12:08:46 +0100 Message-Id: <1112e844ae9231af01f3b4fd4f34cc980d4685ff.1574161682.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] tests: virschema: Propagate errors from directory traversal in testSchemaDir 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 X-MC-Unique: Nz9swws8NhWmpMADWzDTjg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" testSchemaDir is a helper which invokes the schema test using virTestRun on all schema files. Since the function itself is not called inside virTestRun any helper function call is not dispatched to the user and thus it's hard to debug the test. Propagate errors from the directory traversal. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- tests/virschematest.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/virschematest.c b/tests/virschematest.c index 8a2322b3bd..df50ef1717 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -76,8 +76,10 @@ testSchemaDir(const char *schema, .validator =3D validator, }; - if (virDirOpen(&dir, dir_path) < 0) + if (virDirOpen(&dir, dir_path) < 0) { + virTestPropagateLibvirtError(); return -1; + } while ((rc =3D virDirRead(dir, &ent, dir_path)) > 0) { g_autofree char *test_name =3D NULL; @@ -97,8 +99,10 @@ testSchemaDir(const char *schema, ret =3D -1; } - if (rc < 0) + if (rc < 0) { + virTestPropagateLibvirtError(); ret =3D -1; + } VIR_DIR_CLOSE(dir); return ret; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list