diff mbox

[libvirt,3/3] testutils: Drop virtTestResult

Message ID 9e35b42c371fd9d2d232942c4e72dc6d5091c8ed.1443570876.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson Sept. 29, 2015, 11:56 p.m. UTC
virtTestResult is suboptimal for a few reasons:

- It poorly duplicates virtTestRun pass/fail reporting logic
- It doesn't have virtTestRun's alloc testing support
- It only reports the test name _after_ the test has run.
- It doesn't follow the standard virtTestRun pattern that most other
  tests use.

There's no users left, so drop it. If any other async tests like eventtest
spring up that don't cleanly fit the virtTestRun pattern, I suggest they
just open code the support for it around virtTestRun
---
 tests/testutils.c | 38 --------------------------------------
 tests/testutils.h |  2 --
 2 files changed, 40 deletions(-)

Comments

Martin Kletzander Sept. 30, 2015, 5:39 a.m. UTC | #1
On Tue, Sep 29, 2015 at 07:56:47PM -0400, Cole Robinson wrote:
>virtTestResult is suboptimal for a few reasons:
>
>- It poorly duplicates virtTestRun pass/fail reporting logic
>- It doesn't have virtTestRun's alloc testing support
>- It only reports the test name _after_ the test has run.
>- It doesn't follow the standard virtTestRun pattern that most other
>  tests use.
>
>There's no users left, so drop it. If any other async tests like eventtest
>spring up that don't cleanly fit the virtTestRun pattern, I suggest they
>just open code the support for it around virtTestRun
>---

ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

diff --git a/tests/testutils.c b/tests/testutils.c
index bd4ff73..857e819 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -119,44 +119,6 @@  static void virTestAllocHook(int nalloc ATTRIBUTE_UNUSED,
 }
 #endif
 
-void virtTestResult(const char *name, int ret, const char *msg, ...)
-{
-    va_list vargs;
-    va_start(vargs, msg);
-
-    if (testCounter == 0 && !virTestGetVerbose())
-        fprintf(stderr, "      ");
-
-    testCounter++;
-    if (virTestGetVerbose()) {
-        fprintf(stderr, "%3zu) %-60s ", testCounter, name);
-        if (ret == 0) {
-            fprintf(stderr, "OK\n");
-        } else {
-            fprintf(stderr, "FAILED\n");
-            if (msg) {
-                char *str;
-                if (virVasprintfQuiet(&str, msg, vargs) == 0) {
-                    fprintf(stderr, "%s", str);
-                    VIR_FREE(str);
-                }
-            }
-        }
-    } else {
-        if (testCounter != 1 &&
-            !((testCounter-1) % 40)) {
-            fprintf(stderr, " %-3zu\n", (testCounter-1));
-            fprintf(stderr, "      ");
-        }
-        if (ret == 0)
-            fprintf(stderr, ".");
-        else
-            fprintf(stderr, "!");
-    }
-
-    va_end(vargs);
-}
-
 #ifdef TEST_OOM_TRACE
 static void
 virTestShowTrace(void)
diff --git a/tests/testutils.h b/tests/testutils.h
index f34a393..ccf1d29 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -48,8 +48,6 @@  extern char *progname;
 
 bool virtTestOOMActive(void);
 
-void virtTestResult(const char *name, int ret, const char *msg, ...)
-    ATTRIBUTE_FMT_PRINTF(3,4);
 int virtTestRun(const char *title,
                 int (*body)(const void *data),
                 const void *data);