From patchwork Fri Mar 3 12:32:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 735051 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vZTVC5r35z9s81 for ; Fri, 3 Mar 2017 23:47:31 +1100 (AEDT) Received: from localhost ([::1]:57567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjmcL-00033W-5Y for incoming@patchwork.ozlabs.org; Fri, 03 Mar 2017 07:47:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjmOJ-0007xS-5O for qemu-devel@nongnu.org; Fri, 03 Mar 2017 07:33:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjmOG-00082B-4J for qemu-devel@nongnu.org; Fri, 03 Mar 2017 07:32:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51250) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cjmOF-00080F-Nm for qemu-devel@nongnu.org; Fri, 03 Mar 2017 07:32:55 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C310EC05AA6F for ; Fri, 3 Mar 2017 12:32:55 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v23CWs1l020847 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 3 Mar 2017 07:32:55 -0500 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 396CC113861F; Fri, 3 Mar 2017 13:32:49 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 3 Mar 2017 13:32:41 +0100 Message-Id: <1488544368-30622-22-git-send-email-armbru@redhat.com> In-Reply-To: <1488544368-30622-1-git-send-email-armbru@redhat.com> References: <1488544368-30622-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 03 Mar 2017 12:32:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 21/28] test-string-input-visitor: Tear down existing test automatically X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" Call visitor_input_teardown() from visitor_input_test_init(), so you don't have to call it from the actual tests. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- tests/test-string-input-visitor.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c index 7f10e25..a32828c 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -39,6 +39,8 @@ static Visitor *visitor_input_test_init(TestInputVisitorData *data, const char *string) { + visitor_input_teardown(data, NULL); + data->v = string_input_visitor_new(string); g_assert(data->v); return data->v; @@ -57,8 +59,6 @@ static void test_visitor_in_int(TestInputVisitorData *data, g_assert(!err); g_assert_cmpint(res, ==, value); - visitor_input_teardown(data, unused); - v = visitor_input_test_init(data, "not an int"); visit_type_int(v, NULL, &res, &err); @@ -87,8 +87,6 @@ static void test_visitor_in_intList(TestInputVisitorData *data, qapi_free_int16List(res); - visitor_input_teardown(data, unused); - v = visitor_input_test_init(data, "not an int list"); visit_type_int16List(v, NULL, &res, &err); @@ -108,35 +106,30 @@ static void test_visitor_in_bool(TestInputVisitorData *data, visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, true); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "yes"); visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, true); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "on"); visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, true); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "false"); visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, false); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "no"); visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, false); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "off"); @@ -190,8 +183,6 @@ static void test_visitor_in_enum(TestInputVisitorData *data, visit_type_EnumOne(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(i, ==, res); - - visitor_input_teardown(data, NULL); } } @@ -224,30 +215,24 @@ static void test_visitor_in_fuzz(TestInputVisitorData *data, v = visitor_input_test_init(data, buf); visit_type_int(v, NULL, &ires, NULL); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); visit_type_intList(v, NULL, &ilres, NULL); qapi_free_intList(ilres); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); visit_type_bool(v, NULL, &bres, NULL); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); visit_type_number(v, NULL, &nres, NULL); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); sres = NULL; visit_type_str(v, NULL, &sres, NULL); g_free(sres); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); visit_type_EnumOne(v, NULL, &eres, NULL); - visitor_input_teardown(data, NULL); } }