On 09/25/2013 11:23 AM, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" <[email protected]> > > Signed-off-by: Daniel P. Berrange <[email protected]> > ---
> tests/testutils.c | 45
> ++++++++++-----------------------------
> tests/testutils.h | 1 -
Largely mechanical; this is the interesting part.
> +++ b/tests/testutils.c
> @@ -123,16 +123,15 @@ void virtTestResult(const char *name, int ret, const
> char *msg, ...)
> }
>
> /*
> - * Runs test and count average time (if the nloops is grater than 1)
Bonus: you are fixing the s/grater/greater/ typo by deleting it :)
> + * Runs test
> *
> * returns: -1 = error, 0 = success
> */
> int
> -virtTestRun(const char *title, int nloops, int (*body)(const void *data),
> const void *data)
> +virtTestRun(const char *title,
> + int (*body)(const void *data), const void *data)
> {
> int ret = 0;
> - size_t i;
> - double *ts = NULL;
>
> if (testCounter == 0 && !virTestGetVerbose())
> fprintf(stderr, " ");
> @@ -149,37 +148,16 @@ virtTestRun(const char *title, int nloops, int
> (*body)(const void *data), const
> if (virTestGetVerbose())
> fprintf(stderr, "%2zu) %-65s ... ", testCounter, title);
>
> - if (nloops > 1 && (VIR_ALLOC_N(ts, nloops) < 0))
> - return -1;
> -
> - for (i=0; i < nloops; i++) {
> - struct timeval before, after;
> -
> - if (ts)
> - GETTIMEOFDAY(&before);
> -
> - virResetLastError();
> - ret = body(data);
> - virErrorPtr err = virGetLastError();
> - if (err) {
> - if (virTestGetVerbose() || virTestGetDebug())
> - virDispatchError(NULL);
> - }
> -
> - if (ret != 0) {
> - break;
> - }
> -
> - if (ts) {
> - GETTIMEOFDAY(&after);
> - ts[i] = DIFF_MSEC(&after, &before);
> - }
> + virResetLastError();
> + ret = body(data);
> + virErrorPtr err = virGetLastError();
> + if (err) {
> + if (virTestGetVerbose() || virTestGetDebug())
> + virDispatchError(NULL);
> }
> +
> if (virTestGetVerbose()) {
> - if (ret == 0 && ts)
> - fprintf(stderr, "OK [%.5f ms]\n",
> - virtTestCountAverage(ts, nloops));
> - else if (ret == 0)
> + if (ret == 0)
> fprintf(stderr, "OK\n");
> else if (ret == EXIT_AM_SKIP)
> fprintf(stderr, "SKIP\n");
> @@ -199,7 +177,6 @@ virtTestRun(const char *title, int nloops, int
> (*body)(const void *data), const
> fprintf(stderr, "!");
> }
>
> - VIR_FREE(ts);
> return ret;
> }
ACK.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
