From 70eb250fd734d50d45314094b84a174c1ac07dec Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Sat, 20 Sep 2025 17:10:30 +0100 Subject: [PATCH] tests: fold: avoid false failures on Solaris 10 * tests/fold/fold-characters.sh: Ensure we have independent verification of the width of characters before testing based on those widths. * tests/fold/fold-zero-width.sh: Likewise. * tests/fold/fold.pl: Only compare the exit status, as the error message can be translated. --- tests/fold/fold-characters.sh | 3 +++ tests/fold/fold-zero-width.sh | 3 +++ tests/fold/fold.pl | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/fold/fold-characters.sh b/tests/fold/fold-characters.sh index 8be54061bd..5c72c9e970 100755 --- a/tests/fold/fold-characters.sh +++ b/tests/fold/fold-characters.sh @@ -25,6 +25,9 @@ test "$LOCALE_FR_UTF8" != none || skip_ "French UTF-8 locale not available" LC_ALL=$LOCALE_FR_UTF8 export LC_ALL +test $(env printf '\uB250\uFF1A' | wc -L) -eq 4 || + skip_ "character width mismatch" + # The string "뉐뉐뉐" is 3 characters, but occupies 6 columns. env printf '\uB250\uB250\uB250\n' > input1 || framework_failure_ env printf '\uB250\uB250\n\uB250\n' > column-exp1 || framework_failure_ diff --git a/tests/fold/fold-zero-width.sh b/tests/fold/fold-zero-width.sh index b876473c75..04cbe4afd6 100755 --- a/tests/fold/fold-zero-width.sh +++ b/tests/fold/fold-zero-width.sh @@ -36,6 +36,9 @@ test "$LOCALE_FR_UTF8" != none || skip_ "French UTF-8 locale not available" LC_ALL=$LOCALE_FR_UTF8 export LC_ALL +test $(env printf '\u200B' | wc -L) -eq 0 || + skip_ "character width mismatch" + # Same thing, but using U+200B ZERO WIDTH SPACE. yes $(env printf '\u200B') | head -n $IO_BUFSIZE_TIMES2 | tr -d '\n' > inp || framework_failure_ diff --git a/tests/fold/fold.pl b/tests/fold/fold.pl index ea9bc5c6af..c4c14e2fdb 100755 --- a/tests/fold/fold.pl +++ b/tests/fold/fold.pl @@ -40,10 +40,9 @@ my @Tests = # The downstream I18N patch made fold(1) exit with success for non-existing # files since v5.2.1-1158-g3d3030da6 (2004) changed int to bool for booleans. # The I18N patch was fixed only in July 2024. (rhbz#2296201). - ['enoent', 'enoent', {EXIT => 1}, - {ERR=>"$prog: enoent: No such file or directory\n"}], + ['enoent', 'enoent', {EXIT => 1}, {ERR_SUBST=>"s/.*//msg"}], - # The downstream I18N patch made 'fold -b' mishandled '\n' in UTF locales. + # The downstream I18N patch made 'fold -b' mishandle '\n' in UTF locales. # The I18N patch was fixed only in Sep 2024. (RHEL-60295) ['bw1', '-b -w 4', {IN=>"abcdef\nghijkl"}, {OUT=>"abcd\nef\nghij\nkl"}], ['bw2', '-b -w 6', {IN=>"1234567890\nabcdefghij\n1234567890"}, -- 2.47.3