From 9409f6b72488f4df550e9bef0da2dce9e2b0c2c8 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 27 Aug 2019 16:00:10 +0200 Subject: [PATCH] virhostdevtest: Check for integer retval in more verbose way MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are few functions called from the test which return an integer but their retval is compared as if it was a pointer. Now, there is nothing wrong with that from machine POV, but from readability perspective it's wrong. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- tests/virhostdevtest.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index d0859a421c..75f876a77f 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -161,22 +161,22 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) active_count = virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count = virPCIDeviceListCount(mgr->inactivePCIHostdevs); VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, - &hostdevs[0], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, + &hostdevs[0], 1, 0) == 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, - &hostdevs[1], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, + &hostdevs[1], 1, 0) == 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, - &hostdevs[2], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, + &hostdevs[2], 1, 0) == 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); @@ -252,22 +252,22 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) active_count = virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count = virPCIDeviceListCount(mgr->inactivePCIHostdevs); VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, - &hostdevs[0], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, + &hostdevs[0], 1, 0) == 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, - &hostdevs[1], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, + &hostdevs[1], 1, 0) == 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, - &hostdevs[2], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, + &hostdevs[2], 1, 0) == 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count);