diff --git a/tests/testutils.c b/tests/testutils.c index 96181b2db615dedf7dc926111f5781d294dc5470..17584acaac2d88a2845ba84aabb03e48aa17b631 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -126,13 +126,20 @@ virtTestRun(const char *title, int nloops, int (*body)(const void *data), const if (ts) GETTIMEOFDAY(&before); + virResetLastError(); - if ((ret = body(data)) != 0) - break; + ret = body(data); virErrorPtr err = virGetLastError(); - if (err) - virDispatchError(NULL); - if (ts) { + if (err) { + if (virTestGetVerbose() || virTestGetDebug()) + virDispatchError(NULL); + } + + if (ret != 0) { + break; + } + + if (ts) { GETTIMEOFDAY(&after); ts[i] = DIFF_MSEC(&after, &before); }