From: Pádraig Brady
Date: Wed, 27 Aug 2025 12:08:57 +0000 (+0100) Subject: tests: fold: copy i18n patch tests X-Git-Tag: v9.8~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0001bbc3e287ea76685adb021f9ef4819929f194;p=thirdparty%2Fcoreutils.git tests: fold: copy i18n patch tests * tests/fold/fold.pl: Copy tests from Fedora, removing copy & pasted logic that was extraneous to either the i18n patch or upstream. --- diff --git a/tests/fold/fold.pl b/tests/fold/fold.pl index 877322e0a7..de34177fda 100755 --- a/tests/fold/fold.pl +++ b/tests/fold/fold.pl @@ -20,9 +20,15 @@ use strict; (my $program_name = $0) =~ s|.*/||; +my $prog = 'fold'; + # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; -my $prog = 'fold'; + +# uncommented to enable multibyte paths +my $mb_locale = $ENV{LOCALE_FR_UTF8}; +! defined $mb_locale || $mb_locale eq 'none' + and $mb_locale = 'C'; my @Tests = ( @@ -44,6 +50,32 @@ my @Tests = {OUT=>"123456\n7890\nabcdef\nghij\n123456\n7890"}], ); +if ($mb_locale ne 'C') + { + # Duplicate each test vector, appending "-mb" to the test name and + # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we + # provide coverage for multi-byte code paths. + my @new; + foreach my $t (@Tests) + { + my @new_t = @$t; + my $test_name = shift @new_t; + + push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; + } + push @Tests, @new; + } + +@Tests = triple_test \@Tests; + +# Remember that triple_test creates from each test with exactly one "IN" +# file two more tests (.p and .r suffix on name) corresponding to reading +# input from a file and from a pipe. The pipe-reading test would fail +# due to a race condition about 1 in 20 times. +# Remove the IN_PIPE version of the "output-is-input" test above. +# The others aren't susceptible because they have three inputs each. +@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests; + my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE};