From nobody Sun Feb 8 12:13:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630788785; cv=none; d=zohomail.com; s=zohoarc; b=heP9wMI2xsuojjIIXGOFD/ahXpkmN+xr4ETFl1PIWtVR+Ra5iEUgvXAk6LhWWukpaalDHNXFGklCfR6+Hz/K7b5yn5wg8QO/wQ9BR9NXjCzkTOFPdFxVUQfWUuCzaQrceNS/tY/RPOyHTLeUmaMe69pLJ5Ou7PwFMgeyk2n5Ifo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630788785; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FmQfYJGnm6RoIt6PY0iclB2kvipKZstOVKpdDFNoiI4=; b=YPcoWqZjaGqLB5L+jMfyWErcrtUnK0zFrn0nONkxBB3D79oF0jgMbi8sdA22mh27+T5F+OCnSIP3JhxreE+qBk/qY7kggRf9013OLdUxA2p6fCQNxpTdGBbfQBd5x4jrKaRU77YKCqcXxEQCwFbd1rk6uBWo75InWsaEILQseE4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1630788785268947.8916493768261; Sat, 4 Sep 2021 13:53:05 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-dxg7BjUSPGC9Uoh-SgaUjw-1; Sat, 04 Sep 2021 16:51:45 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EBA31854E27; Sat, 4 Sep 2021 20:51:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E67266B543; Sat, 4 Sep 2021 20:51:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B9186180BAB5; Sat, 4 Sep 2021 20:51:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 184Kiod5008934 for ; Sat, 4 Sep 2021 16:44:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 99CD61F4; Sat, 4 Sep 2021 20:44:50 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 232C826367 for ; Sat, 4 Sep 2021 20:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630788784; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FmQfYJGnm6RoIt6PY0iclB2kvipKZstOVKpdDFNoiI4=; b=Jkz+pEW47P+R4pfWkyMwid3ToPhXwsMGrCpr0P5isOpMHA/+CXzQlgWAyHb/R3C9jA3chM OX7fClEDaJqRdU9ckC0luq+Z47u/rTG5Zs7OnuXCvZR7yZ+LEtngCsUpaF0K2qvUdYogof FvrkY+ktqXebb4l2Pfxlu+sSxWL2oJI= X-MC-Unique: dxg7BjUSPGC9Uoh-SgaUjw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 22/24] tests: vshtabletest: remove pointless labels Date: Sat, 4 Sep 2021 22:44:20 +0200 Message-Id: <631d796eb3fe1a50cafc267b2e6bd86b9be43159.1630788206.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630788785797100001 Signed-off-by: J=C3=A1n Tomko --- tests/vshtabletest.c | 71 +++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 43 deletions(-) diff --git a/tests/vshtabletest.c b/tests/vshtabletest.c index 569d7a852f..716b11dbc0 100644 --- a/tests/vshtabletest.c +++ b/tests/vshtabletest.c @@ -81,42 +81,38 @@ testVshTableHeader(const void *opaque G_GNUC_UNUSED) static int testVshTableRowAppend(const void *opaque G_GNUC_UNUSED) { - int ret =3D 0; - g_autoptr(vshTable) table =3D vshTableNew("Id", "Name", NULL); if (!table) - goto cleanup; + return -1; =20 if (vshTableRowAppend(table, NULL) >=3D 0) { fprintf(stderr, "Appending NULL shouldn't work\n"); - ret =3D -1; + return -1; } =20 if (vshTableRowAppend(table, "2", NULL) >=3D 0) { fprintf(stderr, "Appending less items than in header\n"); - ret =3D -1; + return -1; } =20 if (vshTableRowAppend(table, "2", "rhel7.5", "running", NULL) >=3D 0) { fprintf(stderr, "Appending more items than in header\n"); - ret =3D -1; + return -1; } =20 if (vshTableRowAppend(table, "2", "rhel7.5", NULL) < 0) { fprintf(stderr, "Appending same number of items as in header" " should not return NULL\n"); - ret =3D -1; + return -1; } =20 - cleanup: - return ret; + return 0; } =20 static int testUnicode(const void *opaque G_GNUC_UNUSED) { - int ret =3D 0; g_autofree char *act =3D NULL; =20 const char *exp =3D @@ -128,7 +124,7 @@ testUnicode(const void *opaque G_GNUC_UNUSED) =20 table =3D vshTableNew("Id", "=E5=90=8D=E7=A8=B1", "=D0=B3=D0=BE=D1=81= =D1=83=D0=B4=D0=B0=D1=80=D1=81=D1=82=D0=B2=D0=BE", NULL); if (!table) - goto cleanup; + return -1; =20 vshTableRowAppend(table, "1", "fedora28", "running", NULL); vshTableRowAppend(table, "2", "=E3=81=A4=E3=81=B8=E3=82=BDrhel7.5=E3= =81=A4=E3=81=B8=E3=82=BD", "running", @@ -136,17 +132,15 @@ testUnicode(const void *opaque G_GNUC_UNUSED) =20 act =3D vshTablePrintToString(table, true); if (virTestCompareToString(exp, act) < 0) - ret =3D -1; + return -1; =20 - cleanup: - return ret; + return 0; } =20 /* Point of this test is to see how table behaves with right to left writi= ng */ static int testUnicodeArabic(const void *opaque G_GNUC_UNUSED) { - int ret =3D 0; g_autofree char *act =3D NULL; =20 const char *exp =3D @@ -167,7 +161,7 @@ testUnicodeArabic(const void *opaque G_GNUC_UNUSED) =20 table =3D vshTableNew("=EF=BB=A1=EF=BA=8D =EF=BB=A2=EF=BB=A3=EF=BA=8D = =EF=BB=95=EF=BA=8E=EF=BA=8C=EF=BB=A3=EF=BA=93", "=EF=BA=93 =EF=BA=8E=EF=BB= =A0=EF=BA=BC=EF=BB=8B", "=EF=BA=8D=EF=BB=B8=EF=BA=9C=EF=BB=A7=EF=BA=8E=EF= =BB=A7", NULL); if (!table) - goto cleanup; + return -1; vshTableRowAppend(table, "1", "=EF=BB=89=EF=BA=AA=EF=BB=B4=EF=BB=9F =EF=BA=8E=EF= =BB=A0=EF=BA=9C=EF=BB=98=EF=BB=B4=EF=BB=9F =EF=BB=95=EF=BA=8E=EF=BB=A3 =EF= =BB=8A=EF=BB=A7, =D9=A3=D9=A0 =EF=BB=8E=EF=BB=B4=EF=BB=A8=EF=BB=B3=EF=BA=8D= =EF=BB=AE=EF=BA=98=EF=BB=A7=EF=BA=8E=EF=BB=A4=EF=BA=97 =EF=BA=8E=EF=BB=A0= =EF=BA=9B=EF=BA=8E=EF=BB=A0=EF=BA=9B=D8=8C =EF=BA=84=EF=BA=B3=EF=BA=AD, =EF= =BA=A9=EF=BB=AE=EF=BB=9F", @@ -177,17 +171,15 @@ testUnicodeArabic(const void *opaque G_GNUC_UNUSED) NULL); act =3D vshTablePrintToString(table, true); if (virTestCompareToString(exp, act) < 0) - ret =3D -1; + return -1; =20 - cleanup: - return ret; + return 0; } =20 /* Testing zero-width characters by inserting few zero-width spaces */ static int testUnicodeZeroWidthChar(const void *opaque G_GNUC_UNUSED) { - int ret =3D 0; g_autoptr(vshTable) table =3D NULL; const char *exp =3D " I\u200Bd Name \u200BStatus\n" @@ -207,22 +199,20 @@ testUnicodeZeroWidthChar(const void *opaque G_GNUC_UN= USED) =20 table =3D vshTableNew("I\u200Bd", "Name", "\u200BStatus", NULL); if (!table) - goto cleanup; + return -1; vshTableRowAppend(table, "1\u200B", "fedora28", "run\u200Bning", NULL); vshTableRowAppend(table, "2", "rhel7.5", "running", NULL); act =3D vshTablePrintToString(table, true); =20 if (virTestCompareToString(exp, act) < 0) - ret =3D -1; + return -1; =20 - cleanup: - return ret; + return 0; } =20 static int testUnicodeCombiningChar(const void *opaque G_GNUC_UNUSED) { - int ret =3D 0; g_autoptr(vshTable) table =3D NULL; const char *exp =3D " Id N=C3=A1me =E2=93=88tatus\n" @@ -233,23 +223,21 @@ testUnicodeCombiningChar(const void *opaque G_GNUC_UN= USED) =20 table =3D vshTableNew("Id", "N=C3=A1me", "=E2=93=88tatus", NULL); if (!table) - goto cleanup; + return -1; vshTableRowAppend(table, "1", "f=C4=9Bdora28", "running", NULL); vshTableRowAppend(table, "2", "rhel", "running", NULL); act =3D vshTablePrintToString(table, true); =20 if (virTestCompareToString(exp, act) < 0) - ret =3D -1; + return -1; =20 - cleanup: - return ret; + return 0; } =20 /* Testing zero-width characters by inserting few zero-width spaces */ static int testUnicodeNonPrintableChar(const void *opaque G_GNUC_UNUSED) { - int ret =3D 0; g_autoptr(vshTable) table =3D NULL; const char *exp =3D " I\\x09d Name Status\n" @@ -260,22 +248,20 @@ testUnicodeNonPrintableChar(const void *opaque G_GNUC= _UNUSED) =20 table =3D vshTableNew("I\td", "Name", "Status", NULL); if (!table) - goto cleanup; + return -1; vshTableRowAppend(table, "1", "f\aedora28", "running", NULL); vshTableRowAppend(table, "2", "rhel7.5", "running", NULL); act =3D vshTablePrintToString(table, true); =20 if (virTestCompareToString(exp, act) < 0) - ret =3D -1; + return -1; =20 - cleanup: - return ret; + return 0; } =20 static int testNTables(const void *opaque G_GNUC_UNUSED) { - int ret =3D 0; g_autoptr(vshTable) table1 =3D NULL; g_autoptr(vshTable) table2 =3D NULL; g_autoptr(vshTable) table3 =3D NULL; @@ -301,7 +287,7 @@ testNTables(const void *opaque G_GNUC_UNUSED) =20 table1 =3D vshTableNew("Id", "Name", "Status", NULL); if (!table1) - goto cleanup; + return -1; vshTableRowAppend(table1, "1", "fedora28", "running", NULL); vshTableRowAppend(table1, "2", "rhel7.5", "running", NULL); vshTableRowAppend(table1, "3", "gazpacho", "", NULL); @@ -309,12 +295,12 @@ testNTables(const void *opaque G_GNUC_UNUSED) =20 table2 =3D vshTableNew("Id", "Name", "Status", NULL); if (!table2) - goto cleanup; + return -1; act2 =3D vshTablePrintToString(table2, true); =20 table3 =3D vshTableNew("Id", NULL); if (!table3) - goto cleanup; + return -1; vshTableRowAppend(table3, "1", NULL); vshTableRowAppend(table3, "2", NULL); vshTableRowAppend(table3, "3", NULL); @@ -322,14 +308,13 @@ testNTables(const void *opaque G_GNUC_UNUSED) act3 =3D vshTablePrintToString(table3, true); =20 if (virTestCompareToString(exp1, act1) < 0) - ret =3D -1; + return -1; if (virTestCompareToString(exp2, act2) < 0) - ret =3D -1; + return -1; if (virTestCompareToString(exp3, act3) < 0) - ret =3D -1; + return -1; =20 - cleanup: - return ret; + return 0; } =20 static int --=20 2.31.1