From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9G58-000132-EH for qemu-devel@nongnu.org; Thu, 29 Sep 2011 08:51:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R9G52-0007yl-FC for qemu-devel@nongnu.org; Thu, 29 Sep 2011 08:51:18 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:44801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9G52-0007yh-8V for qemu-devel@nongnu.org; Thu, 29 Sep 2011 08:51:12 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e39.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p8TCZONT006990 for ; Thu, 29 Sep 2011 06:35:24 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8TCpAZq151374 for ; Thu, 29 Sep 2011 06:51:10 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8TCpAq3020247 for ; Thu, 29 Sep 2011 06:51:10 -0600 Message-ID: <4E8469BC.40405@us.ibm.com> Date: Thu, 29 Sep 2011 07:51:08 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1317221085-5825-1-git-send-email-lcapitulino@redhat.com> <1317221085-5825-9-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1317221085-5825-9-git-send-email-lcapitulino@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 08/21] qapi: add test cases for generated free functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com On 09/28/2011 09:44 AM, Luiz Capitulino wrote: > 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..7db38b6 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 = strdup("hi there 42"); > + > + qapi_free_UserDefOne(ud1test); > + > + ud1a = g_malloc0(sizeof(UserDefOne)); > + ud1a->integer = 43; > + ud1a->string = strdup("hi there 43"); > + > + ud1b = g_malloc0(sizeof(UserDefOne)); > + ud1b->integer = 44; > + ud1b->string = strdup("hi there 44"); Minor nit: this should be g_strdup. Regards, Anthony Liguori > + > + 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();