aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-08-06 08:53:34 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-08-16 08:42:06 +0200
commit530e79a822b9a0336705f2b262546e843c4bf90b (patch)
tree17ac2348fab8f665d3b1ad58f415b83be6d570e3
parent015715f554f19a809cd80ff53a3881fddfda1336 (diff)
downloadqemu-530e79a822b9a0336705f2b262546e843c4bf90b.zip
qemu-530e79a822b9a0336705f2b262546e843c4bf90b.tar.gz
qemu-530e79a822b9a0336705f2b262546e843c4bf90b.tar.bz2
cpu-plug-test: Don't pass integers as strings to device_add
test_plug_with_device_add_x86() plugs Haswell-i386-cpu and Haswell-x86_64-cpu with device_add. It passes socket-id, core-id, thread-id as JSON strings. The properties are actually integers. test_plug_with_device_add_coreid() plugs power8_v2.0-spapr-cpu-core and qemu-s390x-cpu with device_add. It passes core-id as JSON string. The properties are actually integers. Passing JSON string values to integer properties works only due to device_add implementation accidents. Fix the test to pass JSON numbers. While there, use %u rather than %i with unsigned int. Cc: Thomas Huth <thuth@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-14-armbru@redhat.com>
-rw-r--r--tests/cpu-plug-test.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c
index 5f39ba0..ab3bf6d 100644
--- a/tests/cpu-plug-test.c
+++ b/tests/cpu-plug-test.c
@@ -88,8 +88,8 @@ static void test_plug_with_device_add_x86(gconstpointer data)
for (c = 0; c < td->cores; c++) {
for (t = 0; t < td->threads; t++) {
char *id = g_strdup_printf("id-%i-%i-%i", s, c, t);
- qtest_qmp_device_add(td->device_model, id, "'socket-id':'%i', "
- "'core-id':'%i', 'thread-id':'%i'",
+ qtest_qmp_device_add(td->device_model, id, "'socket-id':%u, "
+ "'core-id':%u, 'thread-id':%u",
s, c, t);
g_free(id);
}
@@ -114,7 +114,7 @@ static void test_plug_with_device_add_coreid(gconstpointer data)
for (c = td->cores; c < td->maxcpus / td->sockets / td->threads; c++) {
char *id = g_strdup_printf("id-%i", c);
- qtest_qmp_device_add(td->device_model, id, "'core-id':'%i'", c);
+ qtest_qmp_device_add(td->device_model, id, "'core-id':%u", c);
g_free(id);
}