diff options
author | Peter Maydell | 2015-12-04 19:11:40 +0100 |
---|---|---|
committer | Peter Maydell | 2015-12-04 19:11:40 +0100 |
commit | a5582eac15171ffea99f9962dd9a4bf3c1dd2f1c (patch) | |
tree | 2388c2239d2c860df58c5b8642e86ec848ab8771 /tests/qom-test.c | |
parent | Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-12-0... (diff) | |
parent | qom-test: Fix qmp() leaks (diff) | |
download | qemu-a5582eac15171ffea99f9962dd9a4bf3c1dd2f1c.tar.gz qemu-a5582eac15171ffea99f9962dd9a4bf3c1dd2f1c.tar.xz qemu-a5582eac15171ffea99f9962dd9a4bf3c1dd2f1c.zip |
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging
QOM infrastructure fixes and device conversions
* Documentation update
* qom-test and related fixes
# gpg: Signature made Fri 04 Dec 2015 17:54:55 GMT using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg: aka "Andreas Färber <afaerber@suse.com>"
* remotes/afaerber/tags/qom-devices-for-peter:
qom-test: Fix qmp() leaks
tests: Use proper functions types instead of void (*fn)
qom: Update documentation comment of struct Object
tests: Fix check-report-qtest-% target
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/qom-test.c')
-rw-r--r-- | tests/qom-test.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tests/qom-test.c b/tests/qom-test.c index fde04e7a19..3e5e8730e7 100644 --- a/tests/qom-test.c +++ b/tests/qom-test.c @@ -47,7 +47,7 @@ static bool is_blacklisted(const char *arch, const char *mach) static void test_properties(const char *path, bool recurse) { char *child_path; - QDict *response, *tuple; + QDict *response, *tuple, *tmp; QList *list; QListEntry *entry; @@ -57,6 +57,7 @@ static void test_properties(const char *path, bool recurse) g_assert(response); if (!recurse) { + QDECREF(response); return; } @@ -75,14 +76,16 @@ static void test_properties(const char *path, bool recurse) } else { const char *prop = qdict_get_str(tuple, "name"); g_test_message("Testing property %s.%s", path, prop); - response = qmp("{ 'execute': 'qom-get'," - " 'arguments': { 'path': %s," - " 'property': %s } }", - path, prop); + tmp = qmp("{ 'execute': 'qom-get'," + " 'arguments': { 'path': %s," + " 'property': %s } }", + path, prop); /* qom-get may fail but should not, e.g., segfault. */ - g_assert(response); + g_assert(tmp); + QDECREF(tmp); } } + QDECREF(response); } static void test_machine(gconstpointer data) @@ -98,9 +101,11 @@ static void test_machine(gconstpointer data) response = qmp("{ 'execute': 'quit' }"); g_assert(qdict_haskey(response, "return")); + QDECREF(response); qtest_end(); g_free(args); + g_free((void *)machine); } static void add_machine_test_cases(void) @@ -129,10 +134,12 @@ static void add_machine_test_cases(void) mname = qstring_get_str(qstr); if (!is_blacklisted(arch, mname)) { path = g_strdup_printf("qom/%s", mname); - qtest_add_data_func(path, mname, test_machine); + qtest_add_data_func(path, g_strdup(mname), test_machine); } } + qtest_end(); + QDECREF(response); } int main(int argc, char **argv) |