From nobody Sun May 5 17:38:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1634308026; cv=none; d=zohomail.com; s=zohoarc; b=EYeCVDMGSVN3wQMaslqMupIViu2RCbawg2vQfE7pAJMuwDv8jue4jjdHBpOQA/4V369zNQV0iAXWQ98XD3Z/PWfnFqctb8xb2s8r40kZni30tGfC5uVgpJA+nwKTd/yT/XtFjAU++dDiG8K126PN3fjCNVFNvDJMurgLnRtOt4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634308026; 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=zaAvV2/xK7i1WgSXjbZ/78Z7nx19ZyYxynTmTjeWt2s=; b=hoAdFx57gLsve+rKYL/738pHl3k2YAFslr50mItxxeorkhGs89Q1A6f5kPZ7r9n6orPV1YfvafNMyRAxCUyJ4sNZeKup7XgoHmhHHAWMNAkPzPHh2N+pkSUvYi6RgPTks7WLJsSezhPGbrwfrU6ryUsAAfFK7dIkcfN6H1iXKrU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1634308026528320.2694650507566; Fri, 15 Oct 2021 07:27:06 -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-444-9bfAQfiUMfK4y5r7BFASKQ-1; Fri, 15 Oct 2021 10:27:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C056250753; Fri, 15 Oct 2021 14:26:58 +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 6C2C660CC4; Fri, 15 Oct 2021 14:26:58 +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 E13A9180598A; Fri, 15 Oct 2021 14:26:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19FEQurT029627 for ; Fri, 15 Oct 2021 10:26:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0696D5F4EA; Fri, 15 Oct 2021 14:26:56 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 848445F4E9 for ; Fri, 15 Oct 2021 14:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634308025; 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=zaAvV2/xK7i1WgSXjbZ/78Z7nx19ZyYxynTmTjeWt2s=; b=HctZ8nqCecO9Im9T9N8SvJP8zUt1oYJu0y4l5wZ9nAh6eiZ9SmelUvkH52GzJEqjpW4lKx PR9MHkMk5sgwZ/akG29Ut3Q9h7wE5wZ6uNU0pDwAWq1lS7f/wdrfgTqzh5KWkTd3ZBIgYv Nh6yWMDtrxSOzLYuTB7htmX2PZogKKc= X-MC-Unique: 9bfAQfiUMfK4y5r7BFASKQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] objecteventtest: Drop lifecycleEventCounter_reset() Date: Fri, 15 Oct 2021 16:26:43 +0200 Message-Id: <03903c4391dc954c39e3b0d68b73bf3fee0be6fa.1634307980.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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: 1634308028693100001 Content-Type: text/plain; charset="utf-8" The sole purpose of the lifecycleEventCounter_reset() function is to zero out given lifecycleEventCounter struct. Well, we can let the compiler zero it out when declaring a variable and just remove the function. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- tests/objecteventtest.c | 66 +++++++++-------------------------------- 1 file changed, 14 insertions(+), 52 deletions(-) diff --git a/tests/objecteventtest.c b/tests/objecteventtest.c index 1e84d4be11..6b1a6acd47 100644 --- a/tests/objecteventtest.c +++ b/tests/objecteventtest.c @@ -82,17 +82,6 @@ typedef struct { int deletedEvents; } lifecycleEventCounter; =20 -static void -lifecycleEventCounter_reset(lifecycleEventCounter *counter) -{ - counter->startEvents =3D 0; - counter->stopEvents =3D 0; - counter->defineEvents =3D 0; - counter->undefineEvents =3D 0; - counter->unexpectedEvents =3D 0; - counter->createdEvents =3D 0; - counter->deletedEvents =3D 0; -} =20 typedef struct { virConnectPtr conn; @@ -202,13 +191,11 @@ static int testDomainCreateXMLOld(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; virDomainPtr dom =3D NULL; int ret =3D -1; bool registered =3D false; =20 - lifecycleEventCounter_reset(&counter); - if (virConnectDomainEventRegister(test->conn, domainLifecycleCb, &counter, NULL) !=3D 0) @@ -242,14 +229,12 @@ static int testDomainCreateXMLNew(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; int eventId =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; virDomainPtr dom =3D NULL; int id; int ret =3D -1; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectDomainEventRegisterAny(test->conn, NULL, eventId, VIR_DOMAIN_EVENT_CALLBACK(&domainLifecycleCb), &counter, NULL); @@ -283,15 +268,13 @@ static int testDomainCreateXMLMixed(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; virDomainPtr dom; int ret =3D -1; int id1 =3D -1; int id2 =3D -1; bool registered =3D false; =20 - lifecycleEventCounter_reset(&counter); - /* Fun with mixing old and new API, also with global and * per-domain. Handler should be fired three times, once for each * registration. */ @@ -360,14 +343,12 @@ static int testDomainDefine(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; int eventId =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; virDomainPtr dom =3D NULL; int id; int ret =3D 0; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectDomainEventRegisterAny(test->conn, NULL, eventId, VIR_DOMAIN_EVENT_CALLBACK(&domainLifecycleCb), &counter, NULL); @@ -411,7 +392,7 @@ static int testDomainStartStopEvent(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; int eventId =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; int id; int ret =3D -1; @@ -419,8 +400,6 @@ testDomainStartStopEvent(const void *data) virConnectPtr conn2 =3D NULL; virDomainPtr dom2 =3D NULL; =20 - lifecycleEventCounter_reset(&counter); - dom =3D virDomainLookupByName(test->conn, "test"); if (dom =3D=3D NULL) return -1; @@ -476,13 +455,11 @@ static int testNetworkCreateXML(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; virNetworkPtr net; int id; int ret =3D 0; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectNetworkEventRegisterAny(test->conn, NULL, VIR_NETWORK_EVENT_ID_LIFECYCLE, VIR_NETWORK_EVENT_CALLBACK(&networkLifecycleCb), @@ -512,13 +489,11 @@ static int testNetworkDefine(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; virNetworkPtr net; int id; int ret =3D 0; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectNetworkEventRegisterAny(test->conn, NULL, VIR_NETWORK_EVENT_ID_LIFECYCLE, VIR_NETWORK_EVENT_CALLBACK(&networkLifecycleCb), @@ -563,15 +538,13 @@ static int testNetworkStartStopEvent(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; int id; int ret =3D 0; =20 if (!test->net) return -1; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectNetworkEventRegisterAny(test->conn, test->net, VIR_NETWORK_EVENT_ID_LIFECYCLE, VIR_NETWORK_EVENT_CALLBACK(&networkLifecycleCb), @@ -599,13 +572,11 @@ static int testStoragePoolCreateXML(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; virStoragePoolPtr pool; int id; int ret =3D 0; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectStoragePoolEventRegisterAny(test->conn, NULL, VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycl= eCb), @@ -635,13 +606,11 @@ static int testStoragePoolDefine(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; virStoragePoolPtr pool; int id; int ret =3D 0; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectStoragePoolEventRegisterAny(test->conn, NULL, VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycl= eCb), @@ -686,7 +655,7 @@ static int testStoragePoolStartStopEvent(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; int refreshCounter; int id1, id2; int ret =3D 0; @@ -694,7 +663,6 @@ testStoragePoolStartStopEvent(const void *data) if (!test->pool) return -1; =20 - lifecycleEventCounter_reset(&counter); refreshCounter =3D 0; =20 id1 =3D virConnectStoragePoolEventRegisterAny(test->conn, test->pool, @@ -730,12 +698,10 @@ static int testStoragePoolBuild(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; int id; int ret =3D 0; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectStoragePoolEventRegisterAny(test->conn, NULL, VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycl= eCb), @@ -762,12 +728,10 @@ static int testStoragePoolDelete(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; int id; int ret =3D 0; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectStoragePoolEventRegisterAny(test->conn, NULL, VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycl= eCb), @@ -793,13 +757,11 @@ static int testNodeDeviceCreateXML(const void *data) { const objecteventTest *test =3D data; - lifecycleEventCounter counter; + lifecycleEventCounter counter =3D { 0 }; virNodeDevicePtr dev; int id; int ret =3D 0; =20 - lifecycleEventCounter_reset(&counter); - id =3D virConnectNodeDeviceEventRegisterAny(test->conn, NULL, VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE, VIR_NODE_DEVICE_EVENT_CALLBACK(&nodeDeviceLifecycl= eCb), --=20 2.32.0 From nobody Sun May 5 17:38:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1634308027; cv=none; d=zohomail.com; s=zohoarc; b=YXgGXaAivV47bjThcMxdFMA2Iktxuts2DfpbHaXBUMtiN/6mqtyufHSyRf6fL9hwaJOry0BWO4XvHBXzk64aPMnFgu1faIYvyF6vpQpGS/7eCbXJRlhdLlbyblVhzBIKYw2/Av8xrpsCFSncB8dTBTylXsq189RywBgRHLSxAa4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634308027; 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=fq3mNidEyfo8H9TTeQckahRZmAbxB0iclU58zN1aUPw=; b=UEfHv3b5nEklH9+y6DI4n6fsIRO4eiRzghnFkAfhlIB9CzEobrMOLR0Gniyeq41siCKKLV/lkiv3YU88QfEDKiRpBx7dHKZCwi5HC/7lUQaC49xeP7DNyTisw6vYDbwiQr17GCrctCRm97GOc1Rz8BpUE5qw7/aybaAo58Ihnwg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 163430802732978.43298505365442; Fri, 15 Oct 2021 07:27:07 -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-442-tmCuBbZiMYiooOxsmdCxDg-1; Fri, 15 Oct 2021 10:27:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7B86101B4A8; Fri, 15 Oct 2021 14:26:58 +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 99A2760E1C; Fri, 15 Oct 2021 14:26:58 +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 F233B4EA37; Fri, 15 Oct 2021 14:26:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19FEQudj029635 for ; Fri, 15 Oct 2021 10:26:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id C9B3D5F4EA; Fri, 15 Oct 2021 14:26:56 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52DAB5F4E9 for ; Fri, 15 Oct 2021 14:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634308026; 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=fq3mNidEyfo8H9TTeQckahRZmAbxB0iclU58zN1aUPw=; b=O27KTLCwJcWSk1u4buDAOLeUj3gx+7xV1c3oG9dfo+gv4ZcsL7P6zZTzXvwpsxh6feDH98 iFCJmPKUyDINCJLGgn0YbJla6+7FIAxz/y4z31IMdfDBCLfAXzcJhVRHZzKGbFNPtA979e +9lqu3AQ+JuE1to8FJehbSKlvXj0XD4= X-MC-Unique: tmCuBbZiMYiooOxsmdCxDg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] objecteventtest: Don't overwrite @ret on failure Date: Fri, 15 Oct 2021 16:26:44 +0200 Message-Id: <6a22d34ca21310fb4097163b79454ec27459ae90.1634307980.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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: 1634308028829100003 Content-Type: text/plain; charset="utf-8" Our general pattern is to initialize @ret to -1 and set it to 0 only at the end of a function. Some functions in objecteventtest.c do not follow this pattern. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- tests/objecteventtest.c | 63 ++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 41 deletions(-) diff --git a/tests/objecteventtest.c b/tests/objecteventtest.c index 6b1a6acd47..5f63f6f5cb 100644 --- a/tests/objecteventtest.c +++ b/tests/objecteventtest.c @@ -347,7 +347,7 @@ testDomainDefine(const void *data) int eventId =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; virDomainPtr dom =3D NULL; int id; - int ret =3D 0; + int ret =3D -1; =20 id =3D virConnectDomainEventRegisterAny(test->conn, NULL, eventId, VIR_DOMAIN_EVENT_CALLBACK(&domainLifecycleCb), @@ -357,12 +357,10 @@ testDomainDefine(const void *data) dom =3D virDomainDefineXML(test->conn, domainDef); =20 if (dom =3D=3D NULL || virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.defineEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 @@ -370,16 +368,14 @@ testDomainDefine(const void *data) virDomainUndefine(dom); =20 if (virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.undefineEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 - + ret =3D 0; cleanup: virConnectDomainEventDeregisterAny(test->conn, id); if (dom !=3D NULL) @@ -458,7 +454,7 @@ testNetworkCreateXML(const void *data) lifecycleEventCounter counter =3D { 0 }; virNetworkPtr net; int id; - int ret =3D 0; + int ret =3D -1; =20 id =3D virConnectNetworkEventRegisterAny(test->conn, NULL, VIR_NETWORK_EVENT_ID_LIFECYCLE, @@ -467,15 +463,14 @@ testNetworkCreateXML(const void *data) net =3D virNetworkCreateXML(test->conn, networkDef); =20 if (!net || virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.startEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 + ret =3D 0; cleanup: virConnectNetworkEventDeregisterAny(test->conn, id); if (net) { @@ -492,7 +487,7 @@ testNetworkDefine(const void *data) lifecycleEventCounter counter =3D { 0 }; virNetworkPtr net; int id; - int ret =3D 0; + int ret =3D -1; =20 id =3D virConnectNetworkEventRegisterAny(test->conn, NULL, VIR_NETWORK_EVENT_ID_LIFECYCLE, @@ -503,12 +498,10 @@ testNetworkDefine(const void *data) net =3D virNetworkDefineXML(test->conn, networkDef); =20 if (!net || virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.defineEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 @@ -516,16 +509,15 @@ testNetworkDefine(const void *data) virNetworkUndefine(net); =20 if (virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.undefineEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 =20 + ret =3D 0; cleanup: virConnectNetworkEventDeregisterAny(test->conn, id); if (net) @@ -540,7 +532,7 @@ testNetworkStartStopEvent(const void *data) const objecteventTest *test =3D data; lifecycleEventCounter counter =3D { 0 }; int id; - int ret =3D 0; + int ret =3D -1; =20 if (!test->net) return -1; @@ -553,15 +545,15 @@ testNetworkStartStopEvent(const void *data) virNetworkDestroy(test->net); =20 if (virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.startEvents !=3D 1 || counter.stopEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } + + ret =3D 0; cleanup: virConnectNetworkEventDeregisterAny(test->conn, id); =20 @@ -575,7 +567,7 @@ testStoragePoolCreateXML(const void *data) lifecycleEventCounter counter =3D { 0 }; virStoragePoolPtr pool; int id; - int ret =3D 0; + int ret =3D -1; =20 id =3D virConnectStoragePoolEventRegisterAny(test->conn, NULL, VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, @@ -584,15 +576,14 @@ testStoragePoolCreateXML(const void *data) pool =3D virStoragePoolCreateXML(test->conn, storagePoolDef, 0); =20 if (!pool || virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.startEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 + ret =3D 0; cleanup: virConnectStoragePoolEventDeregisterAny(test->conn, id); if (pool) { @@ -609,7 +600,7 @@ testStoragePoolDefine(const void *data) lifecycleEventCounter counter =3D { 0 }; virStoragePoolPtr pool; int id; - int ret =3D 0; + int ret =3D -1; =20 id =3D virConnectStoragePoolEventRegisterAny(test->conn, NULL, VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, @@ -620,12 +611,10 @@ testStoragePoolDefine(const void *data) pool =3D virStoragePoolDefineXML(test->conn, storagePoolDef, 0); =20 if (!pool || virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.defineEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 @@ -633,16 +622,14 @@ testStoragePoolDefine(const void *data) virStoragePoolUndefine(pool); =20 if (virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.undefineEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 - + ret =3D 0; cleanup: virConnectStoragePoolEventDeregisterAny(test->conn, id); if (pool) @@ -656,15 +643,13 @@ testStoragePoolStartStopEvent(const void *data) { const objecteventTest *test =3D data; lifecycleEventCounter counter =3D { 0 }; - int refreshCounter; + int refreshCounter =3D 0; int id1, id2; - int ret =3D 0; + int ret =3D -1; =20 if (!test->pool) return -1; =20 - refreshCounter =3D 0; - id1 =3D virConnectStoragePoolEventRegisterAny(test->conn, test->pool, VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycl= eCb), @@ -678,16 +663,15 @@ testStoragePoolStartStopEvent(const void *data) virStoragePoolDestroy(test->pool); =20 if (virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.startEvents !=3D 1 || counter.stopEvents !=3D 1 || refreshCounter !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 + ret =3D 0; cleanup: virConnectStoragePoolEventDeregisterAny(test->conn, id1); virConnectStoragePoolEventDeregisterAny(test->conn, id2); @@ -700,7 +684,7 @@ testStoragePoolBuild(const void *data) const objecteventTest *test =3D data; lifecycleEventCounter counter =3D { 0 }; int id; - int ret =3D 0; + int ret =3D -1; =20 id =3D virConnectStoragePoolEventRegisterAny(test->conn, NULL, VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, @@ -710,15 +694,14 @@ testStoragePoolBuild(const void *data) virStoragePoolBuild(test->pool, 0); =20 if (virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.createdEvents !=3D 1) { - ret =3D -1; goto cleanup; } =20 + ret =3D 0; cleanup: virConnectStoragePoolEventDeregisterAny(test->conn, id); return ret; @@ -730,7 +713,7 @@ testStoragePoolDelete(const void *data) const objecteventTest *test =3D data; lifecycleEventCounter counter =3D { 0 }; int id; - int ret =3D 0; + int ret =3D -1; =20 id =3D virConnectStoragePoolEventRegisterAny(test->conn, NULL, VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, @@ -740,15 +723,14 @@ testStoragePoolDelete(const void *data) virStoragePoolDelete(test->pool, 0); =20 if (virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.deletedEvents !=3D 1) { - ret =3D -1; goto cleanup; } =20 + ret =3D 0; cleanup: virConnectStoragePoolEventDeregisterAny(test->conn, id); return ret; @@ -760,7 +742,7 @@ testNodeDeviceCreateXML(const void *data) lifecycleEventCounter counter =3D { 0 }; virNodeDevicePtr dev; int id; - int ret =3D 0; + int ret =3D -1; =20 id =3D virConnectNodeDeviceEventRegisterAny(test->conn, NULL, VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE, @@ -770,16 +752,15 @@ testNodeDeviceCreateXML(const void *data) virNodeDeviceDestroy(dev); =20 if (!dev || virEventRunDefaultImpl() < 0) { - ret =3D -1; goto cleanup; } =20 if (counter.createdEvents !=3D 1 || counter.deletedEvents !=3D 1 || counter.unexpectedEvents > 0) { - ret =3D -1; goto cleanup; } =20 + ret =3D 0; cleanup: virConnectNodeDeviceEventDeregisterAny(test->conn, id); if (dev) --=20 2.32.0