[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/53] tests/qmp-cmd-test: Add qmp/object-add-duplicate-id
From: |
Paolo Bonzini |
Subject: |
[PULL 05/53] tests/qmp-cmd-test: Add qmp/object-add-duplicate-id |
Date: |
Mon, 6 Jul 2020 12:41:07 -0400 |
From: Eric Auger <eric.auger@redhat.com>
This new test checks that attempting to create an object
with an existing ID gracefully fails.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200629193424.30280-3-eric.auger@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/qtest/qmp-cmd-test.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
index 9f5228cd99..fc65fa3726 100644
--- a/tests/qtest/qmp-cmd-test.c
+++ b/tests/qtest/qmp-cmd-test.c
@@ -213,6 +213,23 @@ static void test_object_add_without_props(void)
qtest_quit(qts);
}
+static void test_object_add_with_duplicate_id(void)
+{
+ QTestState *qts;
+ QDict *resp;
+
+ qts = qtest_init(common_args);
+ resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
+ " {'qom-type': 'memory-backend-ram', 'id': 'ram1',
'props': {'size': 1048576 } } }");
+ g_assert_nonnull(resp);
+ g_assert(qdict_haskey(resp, "return"));
+ resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
+ " {'qom-type': 'memory-backend-ram', 'id': 'ram1',
'props': {'size': 1048576 } } }");
+ g_assert_nonnull(resp);
+ qmp_assert_error_class(resp, "GenericError");
+ qtest_quit(qts);
+}
+
int main(int argc, char *argv[])
{
QmpSchema schema;
@@ -225,6 +242,8 @@ int main(int argc, char *argv[])
qtest_add_func("qmp/object-add-without-props",
test_object_add_without_props);
+ qtest_add_func("qmp/object-add-duplicate-id",
+ test_object_add_with_duplicate_id);
/* TODO: add coverage of generic object-add failure modes */
ret = g_test_run();
--
2.26.2
- [PULL 00/53] Misc patches for QEMU 5.1 soft freeze, Paolo Bonzini, 2020/07/06
- [PULL 02/53] tests: Inject test name also when the test fails, Paolo Bonzini, 2020/07/06
- [PULL 04/53] qom: Introduce object_property_try_add_child(), Paolo Bonzini, 2020/07/06
- [PULL 05/53] tests/qmp-cmd-test: Add qmp/object-add-duplicate-id,
Paolo Bonzini <=
- [PULL 03/53] util/qemu-error: prepend guest name to error message to identify affected VM owner, Paolo Bonzini, 2020/07/06
- [PULL 06/53] tests/qmp-cmd-test: Add qmp/object-add-failure-modes, Paolo Bonzini, 2020/07/06
- [PULL 10/53] KVM: add support for AMD nested live migration, Paolo Bonzini, 2020/07/06
- [PULL 07/53] hw/core/null-machine: Do not initialize unused chardev backends, Paolo Bonzini, 2020/07/06
- [PULL 08/53] target/i386: set SSE FTZ in correct floating-point state, Paolo Bonzini, 2020/07/06
- [PULL 12/53] i386: hvf: Set env->eip in macvm_set_rip(), Paolo Bonzini, 2020/07/06
- [PULL 14/53] i386: hvf: Add hvf_cpu_synchronize_pre_loadvm(), Paolo Bonzini, 2020/07/06
- [PULL 09/53] target/i386: fix IEEE SSE floating-point exception raising, Paolo Bonzini, 2020/07/06
- [PULL 17/53] i386: hvf: Don't duplicate register reset, Paolo Bonzini, 2020/07/06
- [PULL 18/53] i386: hvf: Clean up synchronize functions, Paolo Bonzini, 2020/07/06