From nobody Sun Apr 28 18:06:08 2024 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 1536057042127185.84057176351075; Tue, 4 Sep 2018 03:30:42 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 649AD37E60; Tue, 4 Sep 2018 10:30:38 +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 6C205173DE; Tue, 4 Sep 2018 10:30:37 +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 C90B51800540; Tue, 4 Sep 2018 10:30:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w84AUUDf008539 for ; Tue, 4 Sep 2018 06:30:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 05E417D4C4; Tue, 4 Sep 2018 10:30:30 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-222.ams2.redhat.com [10.36.117.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E2C46351C; Tue, 4 Sep 2018 10:30:27 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 4 Sep 2018 11:30:24 +0100 Message-Id: <20180904103024.13851-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] tests: skip some unicode tests if expected output won't match 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-Type: text/plain; charset="utf-8" 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 04 Sep 2018 10:30:41 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 The expected output strings from the vshtabletest.c are created on a modern Linux host where unicode printing support is very good. On older Linux platforms, or non-Linux platforms, some unicode characters will not be considered printable. While the vsh table alignment code will stil do the right thing with escaping & aligning in this case, the result will not match the test's expected output. Since we know the code is working correctly, do a check with iswprint() to validate the platform's quality and skip the test if it fails. This fixes the test on FreeBSD platforms. Signed-off-by: Daniel P. Berrang=C3=A9 --- Pushed as a build fix tests/vshtabletest.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/vshtabletest.c b/tests/vshtabletest.c index 9e9c045226..1138e34161 100644 --- a/tests/vshtabletest.c +++ b/tests/vshtabletest.c @@ -21,6 +21,7 @@ #include #include #include +#include =20 #include "internal.h" #include "testutils.h" @@ -158,6 +159,15 @@ testUnicodeArabic(const void *opaque ATTRIBUTE_UNUSED) " 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 =EF=BA=A9=EF=BB=AE=EF=BB=9F. =EF=BA=84=EF=BB=A3=EF= =BA=8E=EF=BB=A3 =EF=BA=8D =EF=BA=8E=EF=BB=A7 =EF=BB=B2=EF=BB=9C=EF=BB=A7 \= n" " =EF=BA=BA=EF=BB=94=EF=BA=A3=EF=BA=93 =EF=BA=96=EF=BB=9C=EF=BA= =98=EF=BB=B4=EF=BB=9B=EF=BA=8D=D9=8B =EF=BB=8A=EF=BB=9F, =EF=BA=8E=EF=BB=A0= =EF=BA=A0=EF=BB=A7=EF=BB=AD=EF=BA=A9 =EF=BB=AD=EF=BA=8E=EF=BB=A0=EF=BB=8C= =EF=BA=97=EF=BA=8D=EF=BA=A9 =EF=BA=B5=EF=BA=AD= \n"; vshTablePtr table; + wchar_t wc; + + /* If this char is not classed as printable, the actual + * output won't match what this test expects. The code + * is still operating correctly, but we have different + * layout */ + mbrtowc(&wc, "=D8=8C", MB_CUR_MAX, NULL); + if (!iswprint(wc)) + return EXIT_AM_SKIP; =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) @@ -192,6 +202,15 @@ testUnicodeZeroWidthChar(const void *opaque ATTRIBUTE_= UNUSED) " 1\u200B fedora28 run\u200Bning \n" " 2 rhel7.5 running \n"; char *act =3D NULL; + wchar_t wc; + + /* If this char is not classed as printable, the actual + * output won't match what this test expects. The code + * is still operating correctly, but we have different + * layout */ + mbrtowc(&wc, "\u200B", MB_CUR_MAX, NULL); + if (!iswprint(wc)) + return EXIT_AM_SKIP; =20 table =3D vshTableNew("I\u200Bd", "Name", "\u200BStatus", NULL); if (!table) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list