Re: [PATCH 9/9] virhostdevtest: s/virReportError/fprintf/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 12, 2019 at 01:54:25PM +0200, Michal Privoznik wrote:
If a test fails, it's stderr is caught in the logs. That's how
our CI works. But virReportError() is not.


Where are you missing the error message?
If you run the tested function through virTestRun, it calls
virDispatchError which should log the error reported via virReportError
to stderr

If I adjust the test:

diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 46627355c3..5b9799399f 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -157,8 +157,8 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void)
    CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count - nhostdevs);

    /* Test conflict */
-    active_count = virPCIDeviceListCount(mgr->activePCIHostdevs);
-    inactive_count = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
+    active_count = virPCIDeviceListCount(mgr->activePCIHostdevs) + 1;
+    inactive_count = virPCIDeviceListCount(mgr->inactivePCIHostdevs) - 1;
    VIR_TEST_DEBUG("Test: prepare same hostdevs for same driver/domain again");
    if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                    &hostdevs[0], 1, 0) == 0)

I can see the error messsage:
$ VIR_TEST_DEBUG=1 ./run tests/virhostdevtest
TEST: virhostdevtest
1) testVirHostdevRoundtripNoGuest                                    ... OK
2) testVirHostdevRoundtripUnmanaged                                  ... Test 0 hostdevs
Test >=1 unmanaged hostdevs
Test: prepare same hostdevs for same driver/domain again
libvirt:  error : internal error: Unexpected count of items in mgr->activePCIHostdevs: 3, expecting 4
FAILED
3) testVirHostdevRoundtripManaged                                    ... Test >=1 hostdevs
libvirt:  error : Requested operation is not valid: PCI device 0000:00:01.0 is in use by driver test_driver, domain test_domain
FAILED
4) testVirHostdevRoundtripMixed                                      ... libvirt:  error : Requested operation is not valid: PCI device 0000:00:01.0 is in use by driver test_driver, domain test_domain
FAILED
5) testVirHostdevOther                                               ... libvirt:  error : internal error: Not resetting active device 0000:00:01.0
FAILED

Jano

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux