* [PATCH] tests: qmp-cmd-test: fix memory leak
@ 2020-07-14 17:15 Li Qiang
2020-07-14 18:00 ` no-reply
2020-07-15 9:04 ` Auger Eric
0 siblings, 2 replies; 3+ messages in thread
From: Li Qiang @ 2020-07-14 17:15 UTC (permalink / raw)
To: armbru, thuth, lvivier, pbonzini, eric.auger; +Cc: Li Qiang, liq3ea, qemu-devel
Fixes: 5b88849e7b9("tests/qmp-cmd-test: Add
qmp/object-add-failure-modes"
Signed-off-by: Li Qiang <liq3ea@163.com>
---
tests/qtest/qmp-cmd-test.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
index c68f99f659..f7b1aa7fdc 100644
--- a/tests/qtest/qmp-cmd-test.c
+++ b/tests/qtest/qmp-cmd-test.c
@@ -230,6 +230,8 @@ static void test_object_add_failure_modes(void)
" 'props': {'size': 1048576 } } }");
g_assert_nonnull(resp);
g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
+
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
" {'qom-type': 'memory-backend-ram', 'id': 'ram1',"
" 'props': {'size': 1048576 } } }");
@@ -241,6 +243,7 @@ static void test_object_add_failure_modes(void)
" {'id': 'ram1' } }");
g_assert_nonnull(resp);
g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
/* attempt to create an object with a property of a wrong type */
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
@@ -249,17 +252,20 @@ static void test_object_add_failure_modes(void)
g_assert_nonnull(resp);
/* now do it right */
qmp_assert_error_class(resp, "GenericError");
+
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"));
+ qobject_unref(resp);
/* delete ram1 object */
resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
" {'id': 'ram1' } }");
g_assert_nonnull(resp);
g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
/* attempt to create an object without the id */
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
@@ -267,18 +273,21 @@ static void test_object_add_failure_modes(void)
" 'props': {'size': 1048576 } } }");
g_assert_nonnull(resp);
qmp_assert_error_class(resp, "GenericError");
+
/* now do it right */
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"));
+ qobject_unref(resp);
/* delete ram1 object */
resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
" {'id': 'ram1' } }");
g_assert_nonnull(resp);
g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
/* attempt to set a non existing property */
resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
@@ -286,23 +295,27 @@ static void test_object_add_failure_modes(void)
" 'props': {'sized': 1048576 } } }");
g_assert_nonnull(resp);
qmp_assert_error_class(resp, "GenericError");
+
/* now do it right */
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"));
+ qobject_unref(resp);
/* delete ram1 object without id */
resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
" {'ida': 'ram1' } }");
g_assert_nonnull(resp);
+ qobject_unref(resp);
/* delete ram1 object */
resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
" {'id': 'ram1' } }");
g_assert_nonnull(resp);
g_assert(qdict_haskey(resp, "return"));
+ qobject_unref(resp);
/* delete ram1 object that does not exist anymore*/
resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tests: qmp-cmd-test: fix memory leak
2020-07-14 17:15 [PATCH] tests: qmp-cmd-test: fix memory leak Li Qiang
@ 2020-07-14 18:00 ` no-reply
2020-07-15 9:04 ` Auger Eric
1 sibling, 0 replies; 3+ messages in thread
From: no-reply @ 2020-07-14 18:00 UTC (permalink / raw)
To: liq3ea
Cc: lvivier, thuth, liq3ea, liq3ea, armbru, qemu-devel, eric.auger, pbonzini
Patchew URL: https://patchew.org/QEMU/20200714171531.83723-1-liq3ea@163.com/
Hi,
This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===
TEST check-unit: tests/test-crypto-secret
TEST check-unit: tests/test-char
**
ERROR:/tmp/qemu-test/src/tests/test-char.c:1204:char_serial_test: 'chr' should not be NULL
ERROR test-char - Bail out! ERROR:/tmp/qemu-test/src/tests/test-char.c:1204:char_serial_test: 'chr' should not be NULL
make: *** [check-unit] Error 1
make: *** Waiting for unfinished jobs....
TEST iotest-qcow2: 029
qemu-system-aarch64: -accel kvm: invalid accelerator kvm
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=40109892cb4947b592110f54dc387d3d', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-fj3d95lf/src/docker-src.2020-07-14-13.45.46.10433:/var/tmp/qemu:z,ro', 'qemu/centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=40109892cb4947b592110f54dc387d3d
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-fj3d95lf/src'
make: *** [docker-run-test-quick@centos7] Error 2
real 15m6.204s
user 0m5.812s
The full log is available at
http://patchew.org/logs/20200714171531.83723-1-liq3ea@163.com/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tests: qmp-cmd-test: fix memory leak
2020-07-14 17:15 [PATCH] tests: qmp-cmd-test: fix memory leak Li Qiang
2020-07-14 18:00 ` no-reply
@ 2020-07-15 9:04 ` Auger Eric
1 sibling, 0 replies; 3+ messages in thread
From: Auger Eric @ 2020-07-15 9:04 UTC (permalink / raw)
To: Li Qiang, armbru, thuth, lvivier, pbonzini; +Cc: liq3ea, qemu-devel
Hi Li,
On 7/14/20 7:15 PM, Li Qiang wrote:
> Fixes: 5b88849e7b9("tests/qmp-cmd-test: Add
> qmp/object-add-failure-modes"
Thank you for fixing this.
Adding a commit message generally is welcome such as for example:
properly free each test response and separate qtest_qmp() calls with
spare lines, in a consistent manner.
>
> Signed-off-by: Li Qiang <liq3ea@163.com>
> ---
> tests/qtest/qmp-cmd-test.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
> index c68f99f659..f7b1aa7fdc 100644
> --- a/tests/qtest/qmp-cmd-test.c
> +++ b/tests/qtest/qmp-cmd-test.c
> @@ -230,6 +230,8 @@ static void test_object_add_failure_modes(void)
> " 'props': {'size': 1048576 } } }");
> g_assert_nonnull(resp);
> g_assert(qdict_haskey(resp, "return"));
> + qobject_unref(resp);
> +
> resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
> " {'qom-type': 'memory-backend-ram', 'id': 'ram1',"
> " 'props': {'size': 1048576 } } }");
> @@ -241,6 +243,7 @@ static void test_object_add_failure_modes(void)
> " {'id': 'ram1' } }");
> g_assert_nonnull(resp);
> g_assert(qdict_haskey(resp, "return"));
> + qobject_unref(resp);
>
> /* attempt to create an object with a property of a wrong type */
> resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
> @@ -249,17 +252,20 @@ static void test_object_add_failure_modes(void)
> g_assert_nonnull(resp);
> /* now do it right */
> qmp_assert_error_class(resp, "GenericError");
> +
> 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"));
> + qobject_unref(resp);
>
> /* delete ram1 object */
> resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
> " {'id': 'ram1' } }");
> g_assert_nonnull(resp);
> g_assert(qdict_haskey(resp, "return"));
> + qobject_unref(resp);
>
> /* attempt to create an object without the id */
> resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
> @@ -267,18 +273,21 @@ static void test_object_add_failure_modes(void)
> " 'props': {'size': 1048576 } } }");
> g_assert_nonnull(resp);
> qmp_assert_error_class(resp, "GenericError");
> +
> /* now do it right */
> 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"));
> + qobject_unref(resp);
>
> /* delete ram1 object */
> resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
> " {'id': 'ram1' } }");
> g_assert_nonnull(resp);
> g_assert(qdict_haskey(resp, "return"));
> + qobject_unref(resp);
>
> /* attempt to set a non existing property */
> resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
> @@ -286,23 +295,27 @@ static void test_object_add_failure_modes(void)
> " 'props': {'sized': 1048576 } } }");
> g_assert_nonnull(resp);
> qmp_assert_error_class(resp, "GenericError");
> +
> /* now do it right */
> 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"));
> + qobject_unref(resp);
>
> /* delete ram1 object without id */
> resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
> " {'ida': 'ram1' } }");
> g_assert_nonnull(resp);
> + qobject_unref(resp);
>
> /* delete ram1 object */
> resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
> " {'id': 'ram1' } }");
> g_assert_nonnull(resp);
> g_assert(qdict_haskey(resp, "return"));
> + qobject_unref(resp);
>
> /* delete ram1 object that does not exist anymore*/
> resp = qtest_qmp(qts, "{'execute': 'object-del', 'arguments':"
>
Besides
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Thanks
Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-15 9:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 17:15 [PATCH] tests: qmp-cmd-test: fix memory leak Li Qiang
2020-07-14 18:00 ` no-reply
2020-07-15 9:04 ` Auger Eric
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).