[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/20] cpu-plug-test: Don't pass integers as strings
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH 12/20] cpu-plug-test: Don't pass integers as strings to device_add |
Date: |
Thu, 12 Jul 2018 13:12:13 +0200 |
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 <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
tests/cpu-plug-test.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c
index 5f39ba0df3..ab3bf6df90 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);
}
--
2.17.1
- [Qemu-devel] [PATCH 00/20] tests: Compile-time format string checking for libqtest.h, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 03/20] libqtest: Clean up how we read device_del messages, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 16/20] migration-test: Make wait_command() cope with '%', Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 01/20] libqtest: Document calling conventions, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 09/20] qobject: qobject_from_jsonv() is dangerous, hide it away, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 12/20] cpu-plug-test: Don't pass integers as strings to device_add,
Markus Armbruster <=
- [Qemu-devel] [PATCH 06/20] qobject: New qobject_from_vjsonf_nofail(), qdict_from_vjsonf_nofail(), Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 18/20] migration-test: Clean up string interpolation into QMP, part 2, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 02/20] libqtest: Rename functions to send QMP messages, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 14/20] migration-test: Make wait_command() return the "return" member, Markus Armbruster, 2018/07/12