From nobody Mon Feb 9 04:28:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1544028498021675.4006736701796; Wed, 5 Dec 2018 08:48:18 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99ED97F6C5; Wed, 5 Dec 2018 16:48:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 654CE18BB7; Wed, 5 Dec 2018 16:48:14 +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 1FA943F60E; Wed, 5 Dec 2018 16:48:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB5Gm7Qj028493 for ; Wed, 5 Dec 2018 11:48:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 642275DA9B; Wed, 5 Dec 2018 16:48:07 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B56885D96F; Wed, 5 Dec 2018 16:48:06 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Dec 2018 17:47:51 +0100 Message-Id: <5f3b789397074a1a8897a929743dbc71272b47c3.1544028281.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 10/10] tests: virerror: Make sure that error messages stay in correct order 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 05 Dec 2018 16:48:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Since we don't look up the error message according to the error code but they have to be in the correct order in virErrorMsgStrings, we need to make sure that they stay in the correct order. Signed-off-by: Peter Krempa Reviewed-by: Erik Skultety --- tests/virerrortest.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/virerrortest.c b/tests/virerrortest.c index 0d0377bfa8..6d333f02d0 100644 --- a/tests/virerrortest.c +++ b/tests/virerrortest.c @@ -87,6 +87,24 @@ virErrorTestMsgs(const void *opaque ATTRIBUTE_UNUSED) } +static int +virErrorTestMsgOrder(const void *opaque ATTRIBUTE_UNUSED) +{ + size_t i; + int ret =3D 0; + + for (i =3D 0; i < VIR_ERR_NUMBER_LAST; i++) { + if (i !=3D virErrorMsgStrings[i].error) { + VIR_TEST_VERBOSE("\nvirErrorMsgStrings[%zu] error code is '%d'= \n", + i, virErrorMsgStrings[i].error); + ret =3D -1; + } + } + + return ret; +} + + static int mymain(void) { @@ -94,6 +112,8 @@ mymain(void) if (virTestRun("error message strings ", virErrorTestMsgs, NULL) < 0) ret =3D -1; + if (virTestRun("error messages are in correct order ", virErrorTestMsg= Order, NULL) < 0) + ret =3D -1; return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list