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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to