From patchwork Mon Oct 24 15:36:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 9392461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5A5E46086B for ; Mon, 24 Oct 2016 16:19:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC3F290F1 for ; Mon, 24 Oct 2016 16:19:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40ADB2917C; Mon, 24 Oct 2016 16:19:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB5FA2913D for ; Mon, 24 Oct 2016 16:19:11 +0000 (UTC) Received: from localhost ([::1]:47885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byhxv-0003p4-4P for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Oct 2016 12:19:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byhJc-0004tJ-Dm for qemu-devel@nongnu.org; Mon, 24 Oct 2016 11:37:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byhJX-0006aH-Is for qemu-devel@nongnu.org; Mon, 24 Oct 2016 11:37:32 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:46197) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1byhJX-0006a7-C8 for qemu-devel@nongnu.org; Mon, 24 Oct 2016 11:37:27 -0400 Received: from red.redhat.com (unknown [IPv6:2602:30a:c7d0:7100:7657:7b6:d81b:9143]) (Authenticated sender: eric@blake.one) by relay3-d.mail.gandi.net (Postfix) with ESMTPA id 3362EA80F5; Mon, 24 Oct 2016 17:37:24 +0200 (CEST) From: Eric Blake To: qemu-devel@nongnu.org Date: Mon, 24 Oct 2016 10:36:22 -0500 Message-Id: <1477323383-12380-2-git-send-email-eblake@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477323383-12380-1-git-send-email-eblake@redhat.com> References: <1477323383-12380-1-git-send-email-eblake@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.70.183.195 Subject: [Qemu-devel] [PATCH 1/2] tests: Simplify expected error checking for qmp output 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: , Cc: Michael Roth , armbru@redhat.com, ptoscano@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Minor test cleanup noticed while writing a new test. Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster --- tests/test-qmp-output-visitor.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c index 513d71f..f7213d2 100644 --- a/tests/test-qmp-output-visitor.c +++ b/tests/test-qmp-output-visitor.c @@ -141,13 +141,11 @@ static void test_visitor_out_enum_errors(TestOutputVisitorData *data, const void *unused) { EnumOne i, bad_values[] = { ENUM_ONE__MAX, -1 }; - Error *err; + Error *err = NULL; for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) { - err = NULL; visit_type_EnumOne(data->ov, "unused", &bad_values[i], &err); - g_assert(err); - error_free(err); + error_free_or_abort(&err); visitor_reset(data); } } @@ -243,16 +241,14 @@ static void test_visitor_out_struct_errors(TestOutputVisitorData *data, EnumOne bad_values[] = { ENUM_ONE__MAX, -1 }; UserDefOne u = {0}; UserDefOne *pu = &u; - Error *err; + Error *err = NULL; int i; for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) { - err = NULL; u.has_enum1 = true; u.enum1 = bad_values[i]; visit_type_UserDefOne(data->ov, "unused", &pu, &err); - g_assert(err); - error_free(err); + error_free_or_abort(&err); visitor_reset(data); } }