]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuhotplugtest: Generate better output
authorJiri Denemark <jdenemar@redhat.com>
Thu, 18 Jul 2013 09:07:21 +0000 (11:07 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 26 Aug 2013 14:09:54 +0000 (16:09 +0200)
Each test case label now contains more data useful to identify the test.

tests/qemuhotplugtest.c

index c7be5f653ec4d50ca39ec0fe98195a52e7f8b511..4f48ee08cf05515f0bf2997442d798574292ccc4 100644 (file)
@@ -96,7 +96,7 @@ testQemuHotplugAttach(virDomainObjPtr vm,
         break;
     default:
         if (virTestGetVerbose())
-            fprintf(stderr, "device type '%s' cannot be attached",
+            fprintf(stderr, "device type '%s' cannot be attached\n",
                     virDomainDeviceTypeToString(dev->type));
         break;
     }
@@ -116,7 +116,7 @@ testQemuHotplugDetach(virDomainObjPtr vm,
         break;
     default:
         if (virTestGetVerbose())
-            fprintf(stderr, "device type '%s' cannot be attached",
+            fprintf(stderr, "device type '%s' cannot be detached\n",
                     virDomainDeviceTypeToString(dev->type));
         break;
     }
@@ -141,7 +141,7 @@ testQemuHotplugUpdate(virDomainObjPtr vm,
         break;
     default:
         if (virTestGetVerbose())
-            fprintf(stderr, "device type '%s' cannot be updated",
+            fprintf(stderr, "device type '%s' cannot be updated\n",
                     virDomainDeviceTypeToString(dev->type));
         break;
     }
@@ -276,33 +276,28 @@ mymain(void)
     if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
         return EXIT_FAILURE;
 
-#define DO_TEST(file, dev, fial, kep, ...)                                  \
+#define DO_TEST(file, ACTION, dev, fial, kep, ...)                          \
+    do {                                                                    \
         const char *my_mon[] = { __VA_ARGS__, NULL};                        \
+        const char *name = file " " #ACTION " " dev;                        \
+        data.action = ACTION;                                               \
         data.domain_filename = file;                                        \
         data.device_filename = dev;                                         \
         data.fail = fial;                                                   \
         data.mon = my_mon;                                                  \
         data.keep = kep;                                                    \
-        if (virtTestRun(#file, 1, testQemuHotplug, &data) < 0)              \
+        if (virtTestRun(name, 1, testQemuHotplug, &data) < 0)               \
             ret = -1;                                                       \
+    } while (0)
 
 #define DO_TEST_ATTACH(file, dev, fial, kep, ...)                           \
-    do {                                                                    \
-        data.action = ATTACH;                                               \
-        DO_TEST(file, dev, fial, kep, __VA_ARGS__)                          \
-    } while (0)
+    DO_TEST(file, ATTACH, dev, fial, kep, __VA_ARGS__)
 
 #define DO_TEST_DETACH(file, dev, fial, kep, ...)                           \
-    do {                                                                    \
-        data.action = DETACH;                                               \
-        DO_TEST(file, dev, fial, kep, __VA_ARGS__)                          \
-    } while (0)
+    DO_TEST(file, DETACH, dev, fial, kep, __VA_ARGS__)
 
 #define DO_TEST_UPDATE(file, dev, fial, kep, ...)                           \
-    do {                                                                    \
-        data.action = UPDATE;                                               \
-        DO_TEST(file, dev, fial, kep, __VA_ARGS__)                          \
-    } while (0)
+    DO_TEST(file, UPDATE, dev, fial, kep, __VA_ARGS__)
 
     DO_TEST_UPDATE("graphics-spice", "graphics-spice-nochange", false, false, NULL);
     DO_TEST_UPDATE("graphics-spice-timeout", "graphics-spice-timeout-nochange", false, false,