aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qobject-input-visitor.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-07 20:36:03 +0400
committerMarkus Armbruster <armbru@redhat.com>2017-06-20 14:31:31 +0200
commit5923f85fb82df7c8c60a89458a5ae856045e5ab1 (patch)
tree6973ec3ada032b06f3a9a4a707a932b1ca9bba25 /tests/test-qobject-input-visitor.c
parent2bc7cfea095dc0ab7fae17e0a620f93ce042cafa (diff)
qapi: update the qobject visitor to use QNUM_U64
Switch to use QNum/uint where appropriate to remove i64 limitation. The input visitor will cast i64 input to u64 for compatibility reasons (existing json QMP client already use negative i64 for large u64, and expect an implicit cast in qemu). Note: before the patch, uint64_t values above INT64_MAX are sent over json QMP as negative values, e.g. UINT64_MAX is sent as -1. After the patch, they are sent unmodified. Clearly a bug fix, but we have to consider compatibility issues anyway. libvirt should cope fine, because its parsing of unsigned integers accepts negative values modulo 2^64. There's hope that other clients will, too. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170607163635.17635-12-marcandre.lureau@redhat.com> [check_native_list() tweaked for consistency with signed case] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/test-qobject-input-visitor.c')
-rw-r--r--tests/test-qobject-input-visitor.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index 928cc2694f..34bab8a913 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -123,7 +123,6 @@ static void test_visitor_in_int(TestInputVisitorData *data,
static void test_visitor_in_uint(TestInputVisitorData *data,
const void *unused)
{
- Error *err = NULL;
uint64_t res = 0;
int64_t i64;
double dbl;
@@ -147,12 +146,10 @@ static void test_visitor_in_uint(TestInputVisitorData *data,
visit_type_uint64(v, NULL, &res, &error_abort);
g_assert_cmpuint(res, ==, (uint64_t)-value);
- /* BUG: value between INT64_MAX+1 and UINT64_MAX rejected */
-
v = visitor_input_test_init(data, "18446744073709551574");
- visit_type_uint64(v, NULL, &res, &err);
- error_free_or_abort(&err);
+ visit_type_uint64(v, NULL, &res, &error_abort);
+ g_assert_cmpuint(res, ==, 18446744073709551574U);
visit_type_number(v, NULL, &dbl, &error_abort);
g_assert_cmpfloat(dbl, ==, 18446744073709552000.0);