]> Git Repo - qemu.git/commitdiff
tests: Use qtest_add_data_func() consistently
authorAndreas Färber <[email protected]>
Wed, 25 Mar 2015 17:40:15 +0000 (18:40 +0100)
committerAndreas Färber <[email protected]>
Fri, 19 Jun 2015 08:29:14 +0000 (10:29 +0200)
Replace uses of g_test_add_data_func() for QTest test cases.

It is still valid to use it for any non-QTest test cases,
which are not run for multiple target binaries.

Suggested-by: John Snow <[email protected]>
Reviewed-by: John Snow <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
tests/ahci-test.c
tests/e1000-test.c
tests/eepro100-test.c
tests/endianness-test.c
tests/pc-cpu-test.c
tests/qom-test.c

index 6e3fa819e0cd040dee32f313c772e515ff26112c..ae9415d74c903a81c63be5b5ba553bb5f53ad9cc 100644 (file)
@@ -1486,7 +1486,6 @@ static void test_io_interface(gconstpointer opaque)
 static void create_ahci_io_test(enum IOMode type, enum AddrMode addr,
                                 enum BuffLen len, enum OffsetType offset)
 {
-    static const char *arch;
     char *name;
     AHCIIOTestOptions *opts = g_malloc(sizeof(AHCIIOTestOptions));
 
@@ -1495,17 +1494,13 @@ static void create_ahci_io_test(enum IOMode type, enum AddrMode addr,
     opts->io_type = type;
     opts->offset = offset;
 
-    if (!arch) {
-        arch = qtest_get_arch();
-    }
-
-    name = g_strdup_printf("/%s/ahci/io/%s/%s/%s/%s", arch,
+    name = g_strdup_printf("ahci/io/%s/%s/%s/%s",
                            io_mode_str[type],
                            addr_mode_str[addr],
                            buff_len_str[len],
                            offset_str[offset]);
 
-    g_test_add_data_func(name, opts, test_io_interface);
+    qtest_add_data_func(name, opts, test_io_interface);
     g_free(name);
 }
 
index 81f164d9e926fb3b140bc9aee503dd60cc27e2d9..7ca6d7e72efbb49db2597652f24389671f70577b 100644 (file)
@@ -44,8 +44,8 @@ int main(int argc, char **argv)
     for (i = 0; i < ARRAY_SIZE(models); i++) {
         char *path;
 
-        path = g_strdup_printf("/%s/e1000/%s", qtest_get_arch(), models[i]);
-        g_test_add_data_func(path, models[i], test_device);
+        path = g_strdup_printf("e1000/%s", models[i]);
+        qtest_add_data_func(path, models[i], test_device);
     }
 
     return g_test_run();
index bf8252627e4fc3fbe4d95e97827cd98f888f759d..8bfaccdcbbf5d61c5ec1e82f6a16e667f09d7b2d 100644 (file)
@@ -54,9 +54,8 @@ int main(int argc, char **argv)
     for (i = 0; i < ARRAY_SIZE(models); i++) {
         char *path;
 
-        path = g_strdup_printf("/%s/eepro100/%s",
-                               qtest_get_arch(), models[i]);
-        g_test_add_data_func(path, models[i], test_device);
+        path = g_strdup_printf("eepro100/%s", models[i]);
+        qtest_add_data_func(path, models[i], test_device);
     }
 
     return g_test_run();
index 26ee734f4225ae02f5b5eed12fd40c1735e71acd..2054338e1839af08acad75fde81ade4a413fad96 100644 (file)
@@ -296,17 +296,17 @@ int main(int argc, char **argv)
         if (strcmp(test_cases[i].arch, arch) != 0) {
             continue;
         }
-        path = g_strdup_printf("/%s/endianness/%s",
-                               arch, test_cases[i].machine);
-        g_test_add_data_func(path, &test_cases[i], test_endianness);
+        path = g_strdup_printf("endianness/%s",
+                               test_cases[i].machine);
+        qtest_add_data_func(path, &test_cases[i], test_endianness);
 
-        path = g_strdup_printf("/%s/endianness/split/%s",
-                               arch, test_cases[i].machine);
-        g_test_add_data_func(path, &test_cases[i], test_endianness_split);
+        path = g_strdup_printf("endianness/split/%s",
+                               test_cases[i].machine);
+        qtest_add_data_func(path, &test_cases[i], test_endianness_split);
 
-        path = g_strdup_printf("/%s/endianness/combine/%s",
-                               arch, test_cases[i].machine);
-        g_test_add_data_func(path, &test_cases[i], test_endianness_combine);
+        path = g_strdup_printf("endianness/combine/%s",
+                               test_cases[i].machine);
+        qtest_add_data_func(path, &test_cases[i], test_endianness_combine);
     }
 
     ret = g_test_run();
index a0122d3d61d4b0984cba2803e330e4718dc576a5..3505c7c43fa4cd78dcc0613c7f4b4e46fee30291 100644 (file)
@@ -75,7 +75,6 @@ static void test_pc_without_cpu_add(gconstpointer data)
 
 static void add_pc_test_cases(void)
 {
-    const char *arch = qtest_get_arch();
     QDict *response, *minfo;
     QList *list;
     const QListEntry *p;
@@ -119,15 +118,15 @@ static void add_pc_test_cases(void)
             (strcmp(mname, "pc-0.12") == 0) ||
             (strcmp(mname, "pc-0.11") == 0) ||
             (strcmp(mname, "pc-0.10") == 0)) {
-            path = g_strdup_printf("/%s/cpu/%s/init/%ux%ux%u&maxcpus=%u",
-                                   arch, mname, data->sockets, data->cores,
+            path = g_strdup_printf("cpu/%s/init/%ux%ux%u&maxcpus=%u",
+                                   mname, data->sockets, data->cores,
                                    data->threads, data->maxcpus);
-            g_test_add_data_func(path, data, test_pc_without_cpu_add);
+            qtest_add_data_func(path, data, test_pc_without_cpu_add);
         } else {
-            path = g_strdup_printf("/%s/cpu/%s/add/%ux%ux%u&maxcpus=%u",
-                                   arch, mname, data->sockets, data->cores,
+            path = g_strdup_printf("cpu/%s/add/%ux%ux%u&maxcpus=%u",
+                                   mname, data->sockets, data->cores,
                                    data->threads, data->maxcpus);
-            g_test_add_data_func(path, data, test_pc_with_cpu_add);
+            qtest_add_data_func(path, data, test_pc_with_cpu_add);
         }
     }
     qtest_end();
index 4246382d38ff94eb80d464692277c34fb59aad17..fde04e7a197554d57895816c66aae137c0fe6ea1 100644 (file)
@@ -128,8 +128,8 @@ static void add_machine_test_cases(void)
         g_assert(qstr);
         mname = qstring_get_str(qstr);
         if (!is_blacklisted(arch, mname)) {
-            path = g_strdup_printf("/%s/qom/%s", arch, mname);
-            g_test_add_data_func(path, mname, test_machine);
+            path = g_strdup_printf("qom/%s", mname);
+            qtest_add_data_func(path, mname, test_machine);
         }
     }
     qtest_end();
This page took 0.042285 seconds and 4 git commands to generate.