From patchwork Wed Oct 5 13:21:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 117870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F3308B6F99 for ; Thu, 6 Oct 2011 01:41:26 +1100 (EST) Received: from localhost ([::1]:58988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBRRN-0005By-9Y for incoming@patchwork.ozlabs.org; Wed, 05 Oct 2011 09:23:17 -0400 Received: from eggs.gnu.org ([140.186.70.92]:51809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBRQf-0003UM-N5 for qemu-devel@nongnu.org; Wed, 05 Oct 2011 09:22:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RBRQe-0001kg-Hp for qemu-devel@nongnu.org; Wed, 05 Oct 2011 09:22:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBRQe-0001kP-8E for qemu-devel@nongnu.org; Wed, 05 Oct 2011 09:22:32 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p95DMVZH025572 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 5 Oct 2011 09:22:31 -0400 Received: from localhost (ovpn-113-108.phx2.redhat.com [10.3.113.108]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p95DMUgx003059; Wed, 5 Oct 2011 09:22:30 -0400 From: Luiz Capitulino To: aliguori@us.ibm.com Date: Wed, 5 Oct 2011 10:21:53 -0300 Message-Id: <1317820931-25872-9-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1317820931-25872-1-git-send-email-lcapitulino@redhat.com> References: <1317820931-25872-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, Michael Roth Subject: [Qemu-devel] [PATCH 08/26] qapi: add test cases for generated free functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Michael Roth Signed-off-by: Michael Roth Signed-off-by: Luiz Capitulino --- test-qmp-commands.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/test-qmp-commands.c b/test-qmp-commands.c index f142cc6..fa5a7bd 100644 --- a/test-qmp-commands.c +++ b/test-qmp-commands.c @@ -98,6 +98,34 @@ static void test_dispatch_cmd_io(void) QDECREF(req); } +/* test generated dealloc functions for generated types */ +static void test_dealloc_types(void) +{ + UserDefOne *ud1test, *ud1a, *ud1b; + UserDefOneList *ud1list; + + ud1test = g_malloc0(sizeof(UserDefOne)); + ud1test->integer = 42; + ud1test->string = g_strdup("hi there 42"); + + qapi_free_UserDefOne(ud1test); + + ud1a = g_malloc0(sizeof(UserDefOne)); + ud1a->integer = 43; + ud1a->string = g_strdup("hi there 43"); + + ud1b = g_malloc0(sizeof(UserDefOne)); + ud1b->integer = 44; + ud1b->string = g_strdup("hi there 44"); + + ud1list = g_malloc0(sizeof(UserDefOneList)); + ud1list->value = ud1a; + ud1list->next = g_malloc0(sizeof(UserDefOneList)); + ud1list->next->value = ud1b; + + qapi_free_UserDefOneList(ud1list); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -105,6 +133,7 @@ int main(int argc, char **argv) g_test_add_func("/0.15/dispatch_cmd", test_dispatch_cmd); g_test_add_func("/0.15/dispatch_cmd_error", test_dispatch_cmd_error); g_test_add_func("/0.15/dispatch_cmd_io", test_dispatch_cmd_io); + g_test_add_func("/0.15/dealloc_types", test_dealloc_types); module_call_init(MODULE_INIT_QAPI); g_test_run();