Improve error reporting in test suites

Before running each test case clear the thread local error
indicator. After running each test case, dispatch any error
that was reported

* tests/testutils.c: Fix error reporting in test suites
This commit is contained in:
Daniel P. Berrange 2010-09-08 17:12:42 +01:00
parent 02fe0e943a
commit 80aa766067

View File

@ -124,8 +124,12 @@ virtTestRun(const char *title, int nloops, int (*body)(const void *data), const
if (ts) if (ts)
GETTIMEOFDAY(&before); GETTIMEOFDAY(&before);
virResetLastError();
if ((ret = body(data)) != 0) if ((ret = body(data)) != 0)
break; break;
virErrorPtr err = virGetLastError();
if (err)
virDispatchError(NULL);
if (ts) { if (ts) {
GETTIMEOFDAY(&after); GETTIMEOFDAY(&after);
ts[i] = DIFF_MSEC(&after, &before); ts[i] = DIFF_MSEC(&after, &before);