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é <berrange@xxxxxxxxxx> --- 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 <stdlib.h> #include <stdio.h> #include <locale.h> +#include <wctype.h> #include "internal.h" #include "testutils.h" @@ -158,6 +159,15 @@ testUnicodeArabic(const void *opaque ATTRIBUTE_UNUSED) " 1 ﻉﺪﻴﻟ ﺎﻠﺜﻘﻴﻟ ﻕﺎﻣ ﻊﻧ, ٣٠ ﻎﻴﻨﻳﺍ ﻮﺘﻧﺎﻤﺗ ﺎﻠﺛﺎﻠﺛ، ﺄﺳﺭ, ﺩﻮﻟ ﺩﻮﻟ. ﺄﻣﺎﻣ ﺍ ﺎﻧ ﻲﻜﻧ \n" " ﺺﻔﺣﺓ ﺖﻜﺘﻴﻛﺍً ﻊﻟ, ﺎﻠﺠﻧﻭﺩ ﻭﺎﻠﻌﺗﺍﺩ ﺵﺭ \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, "،", MB_CUR_MAX, NULL); + if (!iswprint(wc)) + return EXIT_AM_SKIP; table = vshTableNew("ﻡﺍ ﻢﻣﺍ ﻕﺎﺌﻣﺓ", "ﺓ ﺎﻠﺼﻋ", "ﺍﻸﺜﻧﺎﻧ", 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 = 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; table = vshTableNew("I\u200Bd", "Name", "\u200BStatus", NULL); if (!table) -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list