diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2020-09-29 11:10:29 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2020-09-29 11:10:29 +0100 |
| commit | 213057383c9f73a17cfe635b204d88e11f918df1 (patch) | |
| tree | f3a1da40a8e48e3b8aaff8d355610e219c0de1cf /tests/test-qapi-event.c | |
| parent | 23290e8070fa18dd8ff930515326e76eeee5810a (diff) | |
| parent | 8138405528c29af2a850cd672a8f8a0b33b7ab40 (diff) | |
| download | focaccia-qemu-213057383c9f73a17cfe635b204d88e11f918df1.tar.gz focaccia-qemu-213057383c9f73a17cfe635b204d88e11f918df1.zip | |
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
virtio,pc,acpi: fixes, tests Fixes and tests all over the place. Batch iommu updates for vdpa. Removal of deprecated cpu hotplug commands. SMBIOS OEM string support. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 29 Sep 2020 08:09:21 BST # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: (48 commits) libvhost-user: return on error in vu_log_queue_fill() libvhost-user: return early on virtqueue errors hw: virtio-pmem: detach the element fromt the virtqueue when error occurs tests/acpi: update golden master DSDT binary table blobs for q35 piix4: don't reserve hw resources when hotplug is off globally Add ACPI DSDT tables for q35 that are being updated by the next patch tests/acpi: add newly added acpi DSDT table blob for pci bridge hotplug flag tests/acpi: unit test for 'acpi-pci-hotplug-with-bridge-support' bridge flag tests/acpi: list added acpi table binary file for pci bridge hotplug test i440fx/acpi: do not add hotplug related amls for cold plugged bridges Fix a gap where acpi_pcihp_find_hotplug_bus() returns a non-hotpluggable bus tests/acpi: add a new ACPI table in order to test root pci hotplug on/off tests/acpi: add new unit test to test hotplug off/on feature on the root pci bus tests/acpi: mark addition of table DSDT.roothp for unit testing root pci hotplug vhost-user: save features of multiqueues if chardev is closed qemu-options: document SMBIOS type 11 settings hw/smbios: report error if table size is too large hw/smbios: support loading OEM strings values from a file tests: acpi: update acpi blobs with new AML x68: acpi: trigger SMI before sending hotplug Notify event to OSPM ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/test-qapi-event.c')
| -rw-r--r-- | tests/test-qapi-event.c | 198 |
1 files changed, 198 insertions, 0 deletions
diff --git a/tests/test-qapi-event.c b/tests/test-qapi-event.c new file mode 100644 index 0000000000..bdeb9095d4 --- /dev/null +++ b/tests/test-qapi-event.c @@ -0,0 +1,198 @@ +/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ + +/* + * schema-defined QAPI event functions + * + * Copyright (c) 2014 Wenchao Xia + * + * Authors: + * Wenchao Xia <wenchaoqemu@gmail.com> + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "test-qapi-event.h" +#include "test-qapi-visit.h" +#include "qapi/qmp-output-visitor.h" +#include "qapi/qmp-event.h" + + +void qapi_event_send_event_a(Error **errp) +{ + QDict *qmp; + Error *err = NULL; + QMPEventFuncEmit emit; + + emit = qmp_event_get_func_emit(); + if (!emit) { + return; + } + + qmp = qmp_event_build_dict("EVENT_A"); + + emit(TEST_QAPI_EVENT_EVENT_A, qmp, &err); + + error_propagate(errp, err); + QDECREF(qmp); +} + +void qapi_event_send_event_b(Error **errp) +{ + QDict *qmp; + Error *err = NULL; + QMPEventFuncEmit emit; + + emit = qmp_event_get_func_emit(); + if (!emit) { + return; + } + + qmp = qmp_event_build_dict("EVENT_B"); + + emit(TEST_QAPI_EVENT_EVENT_B, qmp, &err); + + error_propagate(errp, err); + QDECREF(qmp); +} + +void qapi_event_send_event_c(bool has_a, int64_t a, bool has_b, UserDefOne *b, const char *c, Error **errp) +{ + QDict *qmp; + Error *err = NULL; + QMPEventFuncEmit emit; + QmpOutputVisitor *qov; + Visitor *v; + q_obj_EVENT_C_arg param = { + has_a, a, has_b, b, (char *)c + }; + + emit = qmp_event_get_func_emit(); + if (!emit) { + return; + } + + qmp = qmp_event_build_dict("EVENT_C"); + + qov = qmp_output_visitor_new(); + v = qmp_output_get_visitor(qov); + + visit_start_struct(v, "EVENT_C", NULL, 0, &err); + if (err) { + goto out; + } + visit_type_q_obj_EVENT_C_arg_members(v, ¶m, &err); + if (!err) { + visit_check_struct(v, &err); + } + visit_end_struct(v); + if (err) { + goto out; + } + + qdict_put_obj(qmp, "data", qmp_output_get_qobject(qov)); + emit(TEST_QAPI_EVENT_EVENT_C, qmp, &err); + +out: + qmp_output_visitor_cleanup(qov); + error_propagate(errp, err); + QDECREF(qmp); +} + +void qapi_event_send_event_d(EventStructOne *a, const char *b, bool has_c, const char *c, bool has_enum3, EnumOne enum3, Error **errp) +{ + QDict *qmp; + Error *err = NULL; + QMPEventFuncEmit emit; + QmpOutputVisitor *qov; + Visitor *v; + q_obj_EVENT_D_arg param = { + a, (char *)b, has_c, (char *)c, has_enum3, enum3 + }; + + emit = qmp_event_get_func_emit(); + if (!emit) { + return; + } + + qmp = qmp_event_build_dict("EVENT_D"); + + qov = qmp_output_visitor_new(); + v = qmp_output_get_visitor(qov); + + visit_start_struct(v, "EVENT_D", NULL, 0, &err); + if (err) { + goto out; + } + visit_type_q_obj_EVENT_D_arg_members(v, ¶m, &err); + if (!err) { + visit_check_struct(v, &err); + } + visit_end_struct(v); + if (err) { + goto out; + } + + qdict_put_obj(qmp, "data", qmp_output_get_qobject(qov)); + emit(TEST_QAPI_EVENT_EVENT_D, qmp, &err); + +out: + qmp_output_visitor_cleanup(qov); + error_propagate(errp, err); + QDECREF(qmp); +} + +void qapi_event_send___org_qemu_x_event(__org_qemu_x_Enum __org_qemu_x_member1, const char *__org_qemu_x_member2, bool has_q_wchar_t, int64_t q_wchar_t, Error **errp) +{ + QDict *qmp; + Error *err = NULL; + QMPEventFuncEmit emit; + QmpOutputVisitor *qov; + Visitor *v; + __org_qemu_x_Struct param = { + __org_qemu_x_member1, (char *)__org_qemu_x_member2, has_q_wchar_t, q_wchar_t + }; + + emit = qmp_event_get_func_emit(); + if (!emit) { + return; + } + + qmp = qmp_event_build_dict("__ORG.QEMU_X-EVENT"); + + qov = qmp_output_visitor_new(); + v = qmp_output_get_visitor(qov); + + visit_start_struct(v, "__ORG.QEMU_X-EVENT", NULL, 0, &err); + if (err) { + goto out; + } + visit_type___org_qemu_x_Struct_members(v, ¶m, &err); + if (!err) { + visit_check_struct(v, &err); + } + visit_end_struct(v); + if (err) { + goto out; + } + + qdict_put_obj(qmp, "data", qmp_output_get_qobject(qov)); + emit(TEST_QAPI_EVENT___ORG_QEMU_X_EVENT, qmp, &err); + +out: + qmp_output_visitor_cleanup(qov); + error_propagate(errp, err); + QDECREF(qmp); +} + +const char *const test_QAPIEvent_lookup[] = { + [TEST_QAPI_EVENT_EVENT_A] = "EVENT_A", + [TEST_QAPI_EVENT_EVENT_B] = "EVENT_B", + [TEST_QAPI_EVENT_EVENT_C] = "EVENT_C", + [TEST_QAPI_EVENT_EVENT_D] = "EVENT_D", + [TEST_QAPI_EVENT___ORG_QEMU_X_EVENT] = "__ORG.QEMU_X-EVENT", + [TEST_QAPI_EVENT__MAX] = NULL, +}; |