[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 34/67] tests/test-qmp-input-strict: Cover missing s
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 34/67] tests/test-qmp-input-strict: Cover missing struct members |
Date: |
Wed, 14 Dec 2016 18:44:28 -0600 |
From: Markus Armbruster <address@hidden>
These tests would have caught the bug fixed by the previous commit.
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
(cherry picked from commit bce3035a44c40bd3ec29d3162025fd350f2d8dbf)
Signed-off-by: Michael Roth <address@hidden>
---
tests/test-qmp-input-strict.c | 46 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c
index 814550a..d87f8b8 100644
--- a/tests/test-qmp-input-strict.c
+++ b/tests/test-qmp-input-strict.c
@@ -193,6 +193,50 @@ static void
test_validate_fail_struct_nested(TestInputVisitorData *data,
g_assert(!udp);
}
+static void test_validate_fail_struct_missing(TestInputVisitorData *data,
+ const void *unused)
+{
+ Error *err = NULL;
+ Visitor *v;
+ QObject *any;
+ GenericAlternate *alt;
+ bool present;
+ int en;
+ int64_t i64;
+ uint32_t u32;
+ int8_t i8;
+ char *str;
+ double dbl;
+
+ v = validate_test_init(data, "{}");
+ visit_start_struct(v, NULL, NULL, 0, &error_abort);
+ visit_start_struct(v, "struct", NULL, 0, &err);
+ error_free_or_abort(&err);
+ visit_start_list(v, "list", NULL, 0, &err);
+ error_free_or_abort(&err);
+ visit_start_alternate(v, "alternate", &alt, sizeof(*alt), false, &err);
+ error_free_or_abort(&err);
+ visit_optional(v, "optional", &present);
+ g_assert(!present);
+ visit_type_enum(v, "enum", &en, EnumOne_lookup, &err);
+ error_free_or_abort(&err);
+ visit_type_int(v, "i64", &i64, &err);
+ error_free_or_abort(&err);
+ visit_type_uint32(v, "u32", &u32, &err);
+ error_free_or_abort(&err);
+ visit_type_int8(v, "i8", &i8, &err);
+ error_free_or_abort(&err);
+ visit_type_str(v, "i8", &str, &err);
+ error_free_or_abort(&err);
+ visit_type_number(v, "dbl", &dbl, &err);
+ error_free_or_abort(&err);
+ visit_type_any(v, "any", &any, &err);
+ error_free_or_abort(&err);
+ visit_type_null(v, "null", &err);
+ error_free_or_abort(&err);
+ visit_end_struct(v, NULL);
+}
+
static void test_validate_fail_list(TestInputVisitorData *data,
const void *unused)
{
@@ -316,6 +360,8 @@ int main(int argc, char **argv)
&testdata, test_validate_fail_struct);
validate_test_add("/visitor/input-strict/fail/struct-nested",
&testdata, test_validate_fail_struct_nested);
+ validate_test_add("/visitor/input-strict/fail/struct-missing",
+ &testdata, test_validate_fail_struct_missing);
validate_test_add("/visitor/input-strict/fail/list",
&testdata, test_validate_fail_list);
validate_test_add("/visitor/input-strict/fail/union-flat",
--
1.9.1
- [Qemu-stable] [PATCH 25/67] block: reintroduce bdrv_flush_all, (continued)
- [Qemu-stable] [PATCH 25/67] block: reintroduce bdrv_flush_all, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 24/67] iscsi: Fix divide-by-zero regression on raw SG devices, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 26/67] qemu: use bdrv_flush_all for vm_stop et al, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 27/67] block-backend: remove blk_flush_all, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 02/67] hw/ppc/spapr: Move code related to "ibm, pa-features" to a separate function, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 30/67] qht: fix unlock-after-free segfault upon resizing, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 29/67] qht: simplify qht_reset_size, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 33/67] qapi: Fix crash when 'any' or 'null' parameter is missing, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 31/67] char: fix missing return in error path for chardev TLS init, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 35/67] rbd: shift byte count as a 64-bit value, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 34/67] tests/test-qmp-input-strict: Cover missing struct members,
Michael Roth <=
- [Qemu-stable] [PATCH 37/67] throttle: Correct access to wrong BlockBackendPublic structures, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 28/67] migrate: Fix cpu-throttle-increment regression in HMP, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 32/67] qmp: fix object-add assert() without props, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 36/67] ppc/kvm: Mark 64kB page size support as disabled if not available, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 39/67] net: rtl8139: limit processing of ring descriptors, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 41/67] memory: Don't use memcpy for ram_device regions, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 38/67] qemu-iotests: Test I/O in a single drive from a throttling group, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 40/67] memory: Replace skip_dump flag with "ram_device", Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 43/67] net: fix sending of data with -net socket, listen backend, Michael Roth, 2016/12/14
- [Qemu-stable] [PATCH 45/67] virtio: allow per-device-class legacy features, Michael Roth, 2016/12/14