tests: Use qtest_add_data_func() consistently
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 <jsnow@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
6bc5cf92c0
commit
53f77e4562
@ -1486,7 +1486,6 @@ static void test_io_interface(gconstpointer opaque)
|
|||||||
static void create_ahci_io_test(enum IOMode type, enum AddrMode addr,
|
static void create_ahci_io_test(enum IOMode type, enum AddrMode addr,
|
||||||
enum BuffLen len, enum OffsetType offset)
|
enum BuffLen len, enum OffsetType offset)
|
||||||
{
|
{
|
||||||
static const char *arch;
|
|
||||||
char *name;
|
char *name;
|
||||||
AHCIIOTestOptions *opts = g_malloc(sizeof(AHCIIOTestOptions));
|
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->io_type = type;
|
||||||
opts->offset = offset;
|
opts->offset = offset;
|
||||||
|
|
||||||
if (!arch) {
|
name = g_strdup_printf("ahci/io/%s/%s/%s/%s",
|
||||||
arch = qtest_get_arch();
|
|
||||||
}
|
|
||||||
|
|
||||||
name = g_strdup_printf("/%s/ahci/io/%s/%s/%s/%s", arch,
|
|
||||||
io_mode_str[type],
|
io_mode_str[type],
|
||||||
addr_mode_str[addr],
|
addr_mode_str[addr],
|
||||||
buff_len_str[len],
|
buff_len_str[len],
|
||||||
offset_str[offset]);
|
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);
|
g_free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ int main(int argc, char **argv)
|
|||||||
for (i = 0; i < ARRAY_SIZE(models); i++) {
|
for (i = 0; i < ARRAY_SIZE(models); i++) {
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
path = g_strdup_printf("/%s/e1000/%s", qtest_get_arch(), models[i]);
|
path = g_strdup_printf("e1000/%s", models[i]);
|
||||||
g_test_add_data_func(path, models[i], test_device);
|
qtest_add_data_func(path, models[i], test_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_test_run();
|
return g_test_run();
|
||||||
|
@ -54,9 +54,8 @@ int main(int argc, char **argv)
|
|||||||
for (i = 0; i < ARRAY_SIZE(models); i++) {
|
for (i = 0; i < ARRAY_SIZE(models); i++) {
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
path = g_strdup_printf("/%s/eepro100/%s",
|
path = g_strdup_printf("eepro100/%s", models[i]);
|
||||||
qtest_get_arch(), models[i]);
|
qtest_add_data_func(path, models[i], test_device);
|
||||||
g_test_add_data_func(path, models[i], test_device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_test_run();
|
return g_test_run();
|
||||||
|
@ -296,17 +296,17 @@ int main(int argc, char **argv)
|
|||||||
if (strcmp(test_cases[i].arch, arch) != 0) {
|
if (strcmp(test_cases[i].arch, arch) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
path = g_strdup_printf("/%s/endianness/%s",
|
path = g_strdup_printf("endianness/%s",
|
||||||
arch, test_cases[i].machine);
|
test_cases[i].machine);
|
||||||
g_test_add_data_func(path, &test_cases[i], test_endianness);
|
qtest_add_data_func(path, &test_cases[i], test_endianness);
|
||||||
|
|
||||||
path = g_strdup_printf("/%s/endianness/split/%s",
|
path = g_strdup_printf("endianness/split/%s",
|
||||||
arch, test_cases[i].machine);
|
test_cases[i].machine);
|
||||||
g_test_add_data_func(path, &test_cases[i], test_endianness_split);
|
qtest_add_data_func(path, &test_cases[i], test_endianness_split);
|
||||||
|
|
||||||
path = g_strdup_printf("/%s/endianness/combine/%s",
|
path = g_strdup_printf("endianness/combine/%s",
|
||||||
arch, test_cases[i].machine);
|
test_cases[i].machine);
|
||||||
g_test_add_data_func(path, &test_cases[i], test_endianness_combine);
|
qtest_add_data_func(path, &test_cases[i], test_endianness_combine);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_test_run();
|
ret = g_test_run();
|
||||||
|
@ -75,7 +75,6 @@ static void test_pc_without_cpu_add(gconstpointer data)
|
|||||||
|
|
||||||
static void add_pc_test_cases(void)
|
static void add_pc_test_cases(void)
|
||||||
{
|
{
|
||||||
const char *arch = qtest_get_arch();
|
|
||||||
QDict *response, *minfo;
|
QDict *response, *minfo;
|
||||||
QList *list;
|
QList *list;
|
||||||
const QListEntry *p;
|
const QListEntry *p;
|
||||||
@ -119,15 +118,15 @@ static void add_pc_test_cases(void)
|
|||||||
(strcmp(mname, "pc-0.12") == 0) ||
|
(strcmp(mname, "pc-0.12") == 0) ||
|
||||||
(strcmp(mname, "pc-0.11") == 0) ||
|
(strcmp(mname, "pc-0.11") == 0) ||
|
||||||
(strcmp(mname, "pc-0.10") == 0)) {
|
(strcmp(mname, "pc-0.10") == 0)) {
|
||||||
path = g_strdup_printf("/%s/cpu/%s/init/%ux%ux%u&maxcpus=%u",
|
path = g_strdup_printf("cpu/%s/init/%ux%ux%u&maxcpus=%u",
|
||||||
arch, mname, data->sockets, data->cores,
|
mname, data->sockets, data->cores,
|
||||||
data->threads, data->maxcpus);
|
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 {
|
} else {
|
||||||
path = g_strdup_printf("/%s/cpu/%s/add/%ux%ux%u&maxcpus=%u",
|
path = g_strdup_printf("cpu/%s/add/%ux%ux%u&maxcpus=%u",
|
||||||
arch, mname, data->sockets, data->cores,
|
mname, data->sockets, data->cores,
|
||||||
data->threads, data->maxcpus);
|
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();
|
qtest_end();
|
||||||
|
@ -128,8 +128,8 @@ static void add_machine_test_cases(void)
|
|||||||
g_assert(qstr);
|
g_assert(qstr);
|
||||||
mname = qstring_get_str(qstr);
|
mname = qstring_get_str(qstr);
|
||||||
if (!is_blacklisted(arch, mname)) {
|
if (!is_blacklisted(arch, mname)) {
|
||||||
path = g_strdup_printf("/%s/qom/%s", arch, mname);
|
path = g_strdup_printf("qom/%s", mname);
|
||||||
g_test_add_data_func(path, mname, test_machine);
|
qtest_add_data_func(path, mname, test_machine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qtest_end();
|
qtest_end();
|
||||||
|
Loading…
Reference in New Issue
Block a user