summaryrefslogtreecommitdiffstats
path: root/tests/test-qobject-input-visitor.c
diff options
context:
space:
mode:
authorPeter Maydell2017-03-23 13:31:52 +0100
committerPeter Maydell2017-03-23 13:31:52 +0100
commitd81d857f4421d205395d55200425daa6591c28a5 (patch)
tree0b383c84ed4a679572bdf7b110809eb97adeca3e /tests/test-qobject-input-visitor.c
parentMerge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (diff)
parentqapi: Fix QemuOpts visitor regression on unvisited input (diff)
downloadqemu-d81d857f4421d205395d55200425daa6591c28a5.tar.gz
qemu-d81d857f4421d205395d55200425daa6591c28a5.tar.xz
qemu-d81d857f4421d205395d55200425daa6591c28a5.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-03-22-v3' into staging
QAPI patches for 2017-03-22 # gpg: Signature made Wed 22 Mar 2017 18:25:15 GMT # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2017-03-22-v3: qapi: Fix QemuOpts visitor regression on unvisited input qom: Avoid unvisited 'id'/'qom-type' in user_creatable_add_opts tests: Expose regression in QemuOpts visitor test-qobject-input-visitor: Cover visit_type_uint64() Revert "hostmem: fix QEMU crash by 'info memdev'" qapi: Fix string input visitor regression for empty lists qapi2texi: Fix translation of *strong* and _emphasized_ tests/qapi-schema: Systematic positive doc comment tests tests/qapi-schema: Make test-qapi.py print docs again qapi: Drop unused QAPIDoc member optional qapi2texi: Fix to actually fail when 'doc-required' is false qapi: Drop excessive Make dependencies on qapi2texi.py MAINTAINERS: Add myself for files I touched recently keyval: Document issues with 'any' and alternate types test-keyval: Cover alternate and 'any' type keyval: Improve some comments test-keyval: Tweaks to improve list coverage Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/test-qobject-input-visitor.c')
-rw-r--r--tests/test-qobject-input-visitor.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index 6eb48fee7b..f965743b6e 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -116,6 +116,34 @@ static void test_visitor_in_int(TestInputVisitorData *data,
g_assert_cmpint(res, ==, value);
}
+static void test_visitor_in_uint(TestInputVisitorData *data,
+ const void *unused)
+{
+ Error *err = NULL;
+ uint64_t res = 0;
+ int value = 42;
+ Visitor *v;
+
+ v = visitor_input_test_init(data, "%d", value);
+
+ visit_type_uint64(v, NULL, &res, &error_abort);
+ g_assert_cmpuint(res, ==, (uint64_t)value);
+
+ /* BUG: value between INT64_MIN and -1 accepted modulo 2^64 */
+
+ v = visitor_input_test_init(data, "%d", -value);
+
+ 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);
+}
+
static void test_visitor_in_int_overflow(TestInputVisitorData *data,
const void *unused)
{
@@ -1225,6 +1253,8 @@ int main(int argc, char **argv)
input_visitor_test_add("/visitor/input/int",
NULL, test_visitor_in_int);
+ input_visitor_test_add("/visitor/input/uint",
+ NULL, test_visitor_in_uint);
input_visitor_test_add("/visitor/input/int_overflow",
NULL, test_visitor_in_int_overflow);
input_visitor_test_add("/visitor/input/int_keyval",