[coreutils] turn on the multibyte path in the testsuite to cover i18n regressions
Ondrej Vasik
ovasik at fedoraproject.org
Thu Nov 28 00:23:19 UTC 2013
commit 3e3be79dfd61dec87a7a3c535087d89ba01fb1cb
Author: Ondřej Vašík <ovasik at redhat.com>
Date: Thu Nov 28 01:24:16 2013 +0100
turn on the multibyte path in the testsuite to cover i18n regressions
coreutils-i18n.patch | 467 +++++++++++++++++++++++++++++++++++++++++++++++++-
coreutils.spec | 6 +-
2 files changed, 463 insertions(+), 10 deletions(-)
---
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index 5f3be7c..6aa1c18 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -4050,29 +4050,29 @@ diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk
tests/misc/sort-month.sh \
diff -urNp coreutils-8.21-orig/tests/misc/cut.pl coreutils-8.21/tests/misc/cut.pl
--- coreutils-8.21-orig/tests/misc/cut.pl 2013-02-05 00:40:31.000000000 +0100
-+++ coreutils-8.21/tests/misc/cut.pl 2013-02-15 14:27:18.974468564 +0100
-@@ -23,9 +23,10 @@ use strict;
++++ coreutils-8.21/tests/misc/cut.pl 2013-11-27 19:47:58.430539269 +0100
+@@ -23,9 +23,11 @@ use strict;
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
-my $mb_locale = $ENV{LOCALE_FR_UTF8};
--! defined $mb_locale || $mb_locale eq 'none'
++my $mb_locale;
++# uncommented enable multibyte paths
++#$mb_locale = $ENV{LOCALE_FR_UTF8};
+ ! defined $mb_locale || $mb_locale eq 'none'
- and $mb_locale = 'C';
-+#my $mb_locale = $ENV{LOCALE_FR_UTF8};
-+#! defined $mb_locale || $mb_locale eq 'none'
-+# and $mb_locale = 'C';
-+my $mb_locale = 'C';
++ and $mb_locale = 'C';
my $prog = 'cut';
my $try = "Try '$prog --help' for more information.\n";
diff -urNp coreutils-8.21-orig/tests/misc/expand.pl coreutils-8.21/tests/misc/expand.pl
--- coreutils-8.21-orig/tests/misc/expand.pl 2013-01-31 01:46:24.000000000 +0100
-+++ coreutils-8.21/tests/misc/expand.pl 2013-02-15 14:25:07.891468472 +0100
++++ coreutils-8.21/tests/misc/expand.pl 2013-11-27 19:47:58.431538769 +0100
@@ -23,6 +23,15 @@ use strict;
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
-+# uncommented according to upstream commit enabling multibyte paths
++#comment out next line to disable multibyte tests
+my $mb_locale = $ENV{LOCALE_FR_UTF8};
+! defined $mb_locale || $mb_locale eq 'none'
+ and $mb_locale = 'C';
@@ -4122,6 +4122,147 @@ diff -urNp coreutils-8.21-orig/tests/misc/expand.pl coreutils-8.21/tests/misc/ex
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
+diff -urNp coreutils-8.21-orig/tests/misc/fold.pl coreutils-8.21/tests/misc/fold.pl
+--- coreutils-8.21-orig/tests/misc/fold.pl 2013-01-31 01:46:24.000000000 +0100
++++ coreutils-8.21/tests/misc/fold.pl 2013-11-27 19:47:58.431538769 +0100
+@@ -20,9 +20,18 @@ use strict;
+
+ (my $program_name = $0) =~ s|.*/||;
+
++my $prog = 'fold';
++my $try = "Try \`$prog --help' for more information.\n";
++my $inval = "$prog: invalid byte, character or field list\n$try";
++
+ # Turn off localization of executable's output.
+ @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+
++# 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 =
+ (
+ ['s1', '-w2 -s', {IN=>"a\t"}, {OUT=>"a\n\t"}],
+@@ -31,9 +40,48 @@ my @Tests =
+ ['s4', '-w4 -s', {IN=>"abc ef\n"}, {OUT=>"abc \nef\n"}],
+ );
+
++# Add _POSIX2_VERSION=199209 to the environment of each test
++# that uses an old-style option like +1.
++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 the distro-added multi-byte code paths.
++ my @new;
++ foreach my $t (@Tests)
++ {
++ my @new_t = @$t;
++ my $test_name = shift @new_t;
++
++ # Depending on whether fold is multi-byte-patched,
++ # it emits different diagnostics:
++ # non-MB: invalid byte or field list
++ # MB: invalid byte, character or field list
++ # Adjust the expected error output accordingly.
++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
++ (@new_t))
++ {
++ my $sub = {ERR_SUBST => 's/, character//'};
++ push @new_t, $sub;
++ push @$t, $sub;
++ }
++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
++ }
++ push @Tests, @new;
++ }
++
++ at 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.
++ at Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests;
++
+ my $save_temps = $ENV{DEBUG};
+ my $verbose = $ENV{VERBOSE};
+
+-my $prog = 'fold';
+ my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
+ exit $fail;
+diff -urNp coreutils-8.21-orig/tests/misc/join.pl coreutils-8.21/tests/misc/join.pl
+--- coreutils-8.21-orig/tests/misc/join.pl 2013-01-31 01:46:24.000000000 +0100
++++ coreutils-8.21/tests/misc/join.pl 2013-11-27 19:47:58.432538269 +0100
+@@ -25,6 +25,15 @@ my $limits = getlimits ();
+
+ my $prog = 'join';
+
++my $try = "Try \`$prog --help' for more information.\n";
++my $inval = "$prog: invalid byte, character or field list\n$try";
++
++my $mb_locale;
++#Comment out next line to disable multibyte tests
++$mb_locale = $ENV{LOCALE_FR_UTF8};
++! defined $mb_locale || $mb_locale eq 'none'
++ and $mb_locale = 'C';
++
+ my $delim = chr 0247;
+ sub t_subst ($)
+ {
+@@ -306,8 +315,49 @@ foreach my $t (@tv)
+ push @Tests, $new_ent;
+ }
+
++# Add _POSIX2_VERSION=199209 to the environment of each test
++# that uses an old-style option like +1.
++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 the distro-added multi-byte code paths.
++ my @new;
++ foreach my $t (@Tests)
++ {
++ my @new_t = @$t;
++ my $test_name = shift @new_t;
++
++ # Depending on whether join is multi-byte-patched,
++ # it emits different diagnostics:
++ # non-MB: invalid byte or field list
++ # MB: invalid byte, character or field list
++ # Adjust the expected error output accordingly.
++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
++ (@new_t))
++ {
++ my $sub = {ERR_SUBST => 's/, character//'};
++ push @new_t, $sub;
++ push @$t, $sub;
++ }
++ #Adjust the output some error messages including test_name for mb
++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR}}
++ (@new_t))
++ {
++ my $sub2 = {ERR_SUBST => "s/$test_name-mb/$test_name/"};
++ push @new_t, $sub2;
++ push @$t, $sub2;
++ }
++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
++ }
++ push @Tests, @new;
++ }
++
+ @Tests = triple_test \@Tests;
+
++#skip invalid-j-mb test, it is failing because of the format
++ at Tests = grep {$_->[0] ne 'invalid-j-mb'} @Tests;
++
+ my $save_temps = $ENV{DEBUG};
+ my $verbose = $ENV{VERBOSE};
+
diff -urNp coreutils-8.21-orig/tests/misc/mb1.I coreutils-8.21/tests/misc/mb1.I
--- coreutils-8.21-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.21/tests/misc/mb1.I 2013-02-15 14:25:07.902467891 +0100
@@ -4203,3 +4344,311 @@ diff -urNp coreutils-8.21-orig/tests/misc/sort-mb-tests.sh coreutils-8.21/tests/
+compare exp out || { fail=1; cat out; }
+
+Exit $fail
+diff -urNp coreutils-8.21-orig/tests/misc/sort-merge.pl coreutils-8.21/tests/misc/sort-merge.pl
+--- coreutils-8.21-orig/tests/misc/sort-merge.pl 2013-01-31 01:46:24.000000000 +0100
++++ coreutils-8.21/tests/misc/sort-merge.pl 2013-11-27 19:47:58.435536769 +0100
+@@ -26,6 +26,15 @@ my $prog = 'sort';
+ # Turn off localization of executable's output.
+ @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+
++my $mb_locale;
++# uncommented according to upstream commit enabling multibyte paths
++#$mb_locale = $ENV{LOCALE_FR_UTF8};
++! defined $mb_locale || $mb_locale eq 'none'
++ and $mb_locale = 'C';
++
++my $try = "Try \`$prog --help' for more information.\n";
++my $inval = "$prog: invalid byte, character or field list\n$try";
++
+ # three empty files and one that says 'foo'
+ my @inputs = (+(map{{IN=> {"empty$_"=> ''}}}1..3), {IN=> {foo=> "foo\n"}});
+
+@@ -77,6 +86,39 @@ my @Tests =
+ {OUT=>$big_input}],
+ );
+
++# Add _POSIX2_VERSION=199209 to the environment of each test
++# that uses an old-style option like +1.
++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 the distro-added multi-byte code paths.
++ my @new;
++ foreach my $t (@Tests)
++ {
++ my @new_t = @$t;
++ my $test_name = shift @new_t;
++
++ # Depending on whether sort is multi-byte-patched,
++ # it emits different diagnostics:
++ # non-MB: invalid byte or field list
++ # MB: invalid byte, character or field list
++ # Adjust the expected error output accordingly.
++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
++ (@new_t))
++ {
++ my $sub = {ERR_SUBST => 's/, character//'};
++ push @new_t, $sub;
++ push @$t, $sub;
++ }
++ next if ($test_name =~ "18g");
++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
++ }
++ push @Tests, @new;
++ }
++
++ at Tests = triple_test \@Tests;
++
+ my $save_temps = $ENV{DEBUG};
+ my $verbose = $ENV{VERBOSE};
+
+diff -urNp coreutils-8.21-orig/tests/misc/sort.pl coreutils-8.21/tests/misc/sort.pl
+--- coreutils-8.21-orig/tests/misc/sort.pl 2013-01-31 01:46:24.000000000 +0100
++++ coreutils-8.21/tests/misc/sort.pl 2013-11-27 19:47:58.436536269 +0100
+@@ -24,10 +24,15 @@ my $prog = 'sort';
+ # Turn off localization of executable's output.
+ @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+
+-my $mb_locale = $ENV{LOCALE_FR_UTF8};
++my $mb_locale;
++#Comment out next line to disable multibyte tests
++$mb_locale = $ENV{LOCALE_FR_UTF8};
+ ! defined $mb_locale || $mb_locale eq 'none'
+ and $mb_locale = 'C';
+
++my $try = "Try \`$prog --help' for more information.\n";
++my $inval = "$prog: invalid byte, character or field list\n$try";
++
+ # Since each test is run with a file name and with redirected stdin,
+ # the name in the diagnostic is either the file name or "-".
+ # Normalize each diagnostic to use '-'.
+@@ -414,6 +419,37 @@
+ and push (@$t, {ENV=>'_POSIX2_VERSION=199209'}), last;
+ }
+ }
++
++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 the distro-added multi-byte code paths.
++ my @new;
++ foreach my $t (@Tests)
++ {
++ my @new_t = @$t;
++ my $test_name = shift @new_t;
++
++ # Depending on whether sort is multi-byte-patched,
++ # it emits different diagnostics:
++ # non-MB: invalid byte or field list
++ # MB: invalid byte, character or field list
++ # Adjust the expected error output accordingly.
++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
++ (@new_t))
++ {
++ my $sub = {ERR_SUBST => 's/, character//'};
++ push @new_t, $sub;
++ push @$t, $sub;
++ }
++ #disable several failing tests until investigation, disable all tests with envvars set
++ next if (grep {ref $_ eq 'HASH' && exists $_->{ENV}} (@new_t));
++ next if ($test_name =~ "18g" or $test_name =~ "sort-numeric" or $test_name =~ "08[ab]" or $test_name =~ "03[def]" or $test_name =~ "h4" or $test_name =~ "n1");
++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
++ }
++ push @Tests, @new;
++ }
+
+ @Tests = triple_test \@Tests;
+
+diff -urNp coreutils-8.21-orig/tests/misc/unexpand.pl coreutils-8.21/tests/misc/unexpand.pl
+--- coreutils-8.21-orig/tests/misc/unexpand.pl 2013-01-31 01:46:24.000000000 +0100
++++ coreutils-8.21/tests/misc/unexpand.pl 2013-11-27 19:47:58.436536269 +0100
+@@ -27,6 +27,14 @@ my $limits = getlimits ();
+
+ my $prog = 'unexpand';
+
++# comment out next line to disable multibyte tests
++my $mb_locale = $ENV{LOCALE_FR_UTF8};
++! defined $mb_locale || $mb_locale eq 'none'
++ and $mb_locale = 'C';
++
++my $try = "Try \`$prog --help' for more information.\n";
++my $inval = "$prog: invalid byte, character or field list\n$try";
++
+ my @Tests =
+ (
+ ['a1', {IN=> ' 'x 1 ."y\n"}, {OUT=> ' 'x 1 ."y\n"}],
+@@ -92,6 +100,37 @@ my @Tests =
+ {EXIT => 1}, {ERR => "$prog: tab stop value is too large\n"}],
+ );
+
++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 the distro-added multi-byte code paths.
++ my @new;
++ foreach my $t (@Tests)
++ {
++ my @new_t = @$t;
++ my $test_name = shift @new_t;
++
++ # Depending on whether unexpand is multi-byte-patched,
++ # it emits different diagnostics:
++ # non-MB: invalid byte or field list
++ # MB: invalid byte, character or field list
++ # Adjust the expected error output accordingly.
++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
++ (@new_t))
++ {
++ my $sub = {ERR_SUBST => 's/, character//'};
++ push @new_t, $sub;
++ push @$t, $sub;
++ }
++ next if ($test_name =~ 'b-1');
++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
++ }
++ push @Tests, @new;
++ }
++
++ at Tests = triple_test \@Tests;
++
+ my $save_temps = $ENV{DEBUG};
+ my $verbose = $ENV{VERBOSE};
+
+diff -urNp coreutils-8.21-orig/tests/misc/uniq.pl coreutils-8.21/tests/misc/uniq.pl
+--- coreutils-8.21-orig/tests/misc/uniq.pl 2013-01-31 01:46:25.000000000 +0100
++++ coreutils-8.21/tests/misc/uniq.pl 2013-11-27 19:47:58.437535769 +0100
+@@ -23,9 +23,17 @@ my $limits = getlimits ();
+ my $prog = 'uniq';
+ my $try = "Try '$prog --help' for more information.\n";
+
++my $inval = "$prog: invalid byte, character or field list\n$try";
++
+ # Turn off localization of executable's output.
+ @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+
++my $mb_locale;
++#Comment out next line to disable multibyte tests
++$mb_locale = $ENV{LOCALE_FR_UTF8};
++! defined $mb_locale || $mb_locale eq 'none'
++ and $mb_locale = 'C';
++
+ # When possible, create a "-z"-testing variant of each test.
+ sub add_z_variants($)
+ {
+@@ -207,7 +215,45 @@
+ $t->[0] =~ /^obs-plus/
+ and push @$t, {ENV=>'_POSIX2_VERSION=199209'};
+ }
++
++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 the distro-added multi-byte code paths.
++ my @new;
++ foreach my $t (@Tests)
++ {
++ my @new_t = @$t;
++ my $test_name = shift @new_t;
++
++ # Depending on whether uniq is multi-byte-patched,
++ # it emits different diagnostics:
++ # non-MB: invalid byte or field list
++ # MB: invalid byte, character or field list
++ # Adjust the expected error output accordingly.
++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
++ (@new_t))
++ {
++ my $sub = {ERR_SUBST => 's/, character//'};
++ push @new_t, $sub;
++ push @$t, $sub;
++ }
++ next if ($test_name =~ "schar" or $test_name =~ "^obs-plus" or $test_name =~ "119");
++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}];
++ }
++ push @Tests, @new;
++ }
+
++# 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.
++
++ at Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests;
++
+ @Tests = add_z_variants \@Tests;
+ @Tests = triple_test \@Tests;
+
+diff -urNp coreutils-8.21-orig/tests/pr/pr-tests.pl coreutils-8.21/tests/pr/pr-tests.pl
+--- coreutils-8.21-orig/tests/pr/pr-tests.pl 2013-01-31 01:46:25.000000000 +0100
++++ coreutils-8.21/tests/pr/pr-tests.pl 2013-11-27 19:48:12.683409258 +0100
+@@ -23,6 +23,15 @@ use strict;
+
+ my $prog = 'pr';
+
++my $mb_locale;
++#Uncomment the following line to enable multibyte tests
++$mb_locale = $ENV{LOCALE_FR_UTF8};
++! defined $mb_locale || $mb_locale eq 'none'
++ and $mb_locale = 'C';
++
++my $try = "Try \`$prog --help' for more information.\n";
++my $inval = "$prog: invalid byte, character or field list\n$try";
++
+ my @tv = (
+
+ # -b option is no longer an official option. But it's still working to
+@@ -466,8 +475,48 @@ push @Tests,
+ {IN=>{3=>"x\ty\tz\n"}},
+ {OUT=>join("\t", qw(a b c m n o x y z)) . "\n"} ];
+
++# Add _POSIX2_VERSION=199209 to the environment of each test
++# that uses an old-style option like +1.
++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 the distro-added multi-byte code paths.
++ my @new;
++ foreach my $t (@Tests)
++ {
++ my @new_t = @$t;
++ my $test_name = shift @new_t;
++
++ # Depending on whether pr is multi-byte-patched,
++ # it emits different diagnostics:
++ # non-MB: invalid byte or field list
++ # MB: invalid byte, character or field list
++ # Adjust the expected error output accordingly.
++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval}
++ (@new_t))
++ {
++ my $sub = {ERR_SUBST => 's/, character//'};
++ push @new_t, $sub;
++ push @$t, $sub;
++ }
++ #temporarily skip some failing tests
++ next if ($test_name =~ "col-0" or $test_name =~ "col-inval");
++ 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.
++ at Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests;
++
+ my $save_temps = $ENV{DEBUG};
+ my $verbose = $ENV{VERBOSE};
+
diff --git a/coreutils.spec b/coreutils.spec
index 68176f3..511ab2d 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.21
-Release: 20%{?dist}
+Release: 21%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -377,6 +377,10 @@ fi
%{_sbindir}/chroot
%changelog
+* Thu Nov 28 2013 Ondrej Vasik <ovasik at redhat.com> 8.21-21
+- turn on the multibyte path in the testsuite to cover
+ i18n regressions
+
* Wed Nov 06 2013 Ondrej Vasik <ovasik at redhat.com> 8.21-20
- fix possible colorls.csh script errors for tcsh with
noclobber set and entered include file (#1027279)
More information about the scm-commits
mailing list