From nobody Sun Feb 8 16:06:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1565610890; cv=none; d=zoho.com; s=zohoarc; b=OoyoE2TCmj1+rgH9gzTDWMpZq+APY7dvPp2W5+xID2337H7PdWJshLuue3t8ucnWHlPETF3PdbqCeMn6CrWTdI2aqD8aJNk9leIiKtc0QdiKv+M+DvsK2QqKkyE3rci1LL6NfazezdWcy+XP0IZEu+D8oTfJYXEkGyoYoOZ27Oc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610890; 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:ARC-Authentication-Results; bh=nzNyqh5idYZaRhbLxiBdUrT9WFVLEXnTxSkEEq1kQt0=; b=gMRYyOv3gF5sVWbTNCyzvOBoN1tZyWxJGXIARcEvZaB6ZZVPbHmNGjDudDh7jRcRsG17bVRKNNz80wtTts2OkLVhqt02oqC9V9c0RBBWfRI7NKm/lrA0yMwlFJcBvzRWTsM5sSus9OuVsbsuiozgyh7+k7y8yDePQQkwDIwxdFw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565610890775733.510102830924; Mon, 12 Aug 2019 04:54:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8278219CF8E; Mon, 12 Aug 2019 11:54:49 +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 637EC5D9CA; Mon, 12 Aug 2019 11:54:49 +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 2E74C180BA9C; Mon, 12 Aug 2019 11:54:49 +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 x7CBsd3K016207 for ; Mon, 12 Aug 2019 07:54:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id BA84E1001947; Mon, 12 Aug 2019 11:54:39 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 446271001B1A for ; Mon, 12 Aug 2019 11:54:39 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:24 +0200 Message-Id: <2ecd87bc11da2d5c49a0f4d14cf8453c1968a1e2.1565610801.git.mprivozn@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 Subject: [libvirt] [PATCH 8/9] virhostdevtest: Reset libvirt error on expected failure 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 12 Aug 2019 11:54:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If a libvirt error occurred during a test, then virTestRun() reports it (regardless of test returning success or failure). For instance, in this specific case, a hostdev is detached twice and the second attempt is expected to fail. It does fail and libvirt error is reported which is then printed onto stderr. Insert virResetLastError() calls on appropriate places to avoid that. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/virhostdevtest.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 248a5493f3..b64ba58923 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -163,6 +163,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, &hostdevs[0], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -170,6 +171,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, &hostdevs[1], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -177,6 +179,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, &hostdevs[2], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -244,6 +247,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, &hostdevs[0], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -251,6 +255,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, &hostdevs[1], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -258,6 +263,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, &hostdevs[2], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list