[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 for-2.9 14/17] test-qobject-input-visitor: Cover v
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL v2 for-2.9 14/17] test-qobject-input-visitor: Cover visit_type_uint64() |
Date: |
Wed, 22 Mar 2017 18:48:25 +0100 |
The new test demonstrates known bugs: integers between INT64_MAX+1 and
UINT64_MAX rejected, and integers between INT64_MIN and -1 are
accepted modulo 2^64.
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
tests/test-qobject-input-visitor.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tests/test-qobject-input-visitor.c
b/tests/test-qobject-input-visitor.c
index 6eb48fe..f965743 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",
--
2.7.4
- [Qemu-devel] [PULL v2 for-2.9 00/17] QAPI patches for 2017-03-22, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 11/17] qapi2texi: Fix translation of *strong* and _emphasized_, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 09/17] tests/qapi-schema: Make test-qapi.py print docs again, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 07/17] qapi2texi: Fix to actually fail when 'doc-required' is false, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 12/17] qapi: Fix string input visitor regression for empty lists, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 02/17] keyval: Improve some comments, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 03/17] test-keyval: Cover alternate and 'any' type, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 14/17] test-qobject-input-visitor: Cover visit_type_uint64(),
Markus Armbruster <=
- [Qemu-devel] [PULL v2 for-2.9 08/17] qapi: Drop unused QAPIDoc member optional, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 01/17] test-keyval: Tweaks to improve list coverage, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 04/17] keyval: Document issues with 'any' and alternate types, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 06/17] qapi: Drop excessive Make dependencies on qapi2texi.py, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 13/17] Revert "hostmem: fix QEMU crash by 'info memdev'", Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 17/17] qapi: Fix QemuOpts visitor regression on unvisited input, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 16/17] qom: Avoid unvisited 'id'/'qom-type' in user_creatable_add_opts, Markus Armbruster, 2017/03/22
- [Qemu-devel] [PULL v2 for-2.9 10/17] tests/qapi-schema: Systematic positive doc comment tests, Markus Armbruster, 2017/03/22