Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 584158 Details for
Bug 821263
Uniq multi-byte patch incompatibilities
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch adding multi-byte functionality tests
coreutils-mb-test.patch (text/plain), 15.45 KB, created by
Andrej Antas
on 2012-05-13 16:50:39 UTC
(
hide
)
Description:
patch adding multi-byte functionality tests
Filename:
MIME Type:
Creator:
Andrej Antas
Created:
2012-05-13 16:50:39 UTC
Size:
15.45 KB
patch
obsolete
>diff --git a/tests/misc/cut b/tests/misc/cut >index 3574551..4879ea0 100755 >--- a/tests/misc/cut >+++ b/tests/misc/cut >@@ -23,10 +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' >-# and $mb_locale = 'C'; >-my $mb_locale = 'C'; >+# uncommented according to upstream commit enabling multibyte paths >+my $mb_locale = $ENV{LOCALE_FR_UTF8}; >+! defined $mb_locale || $mb_locale eq 'none' >+ and $mb_locale = 'C'; >+# my $mb_locale = 'C'; > > my $prog = 'cut'; > my $try = "Try \`$prog --help' for more information.\n"; >diff --git a/tests/misc/expand b/tests/misc/expand >index 581a912..0869b7c 100755 >--- a/tests/misc/expand >+++ b/tests/misc/expand >@@ -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 >+my $mb_locale = $ENV{LOCALE_FR_UTF8}; >+! defined $mb_locale || $mb_locale eq 'none' >+ and $mb_locale = 'C'; >+ >+my $prog = 'expand'; >+my $try = "Try \`$prog --help' for more information.\n"; >+my $inval = "$prog: invalid byte, character or field list\n$try"; >+ > my @Tests = > ( > ['t1', '--tabs=3', {IN=>"a\tb"}, {OUT=>"a b"}], >@@ -31,6 +40,37 @@ my @Tests = > ['i2', '--tabs=3 -i', {IN=>" \ta\tb"}, {OUT=>" a\tb"}], > ); > >+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 expand 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; >+ } >+ >+ >+@Tests = triple_test \@Tests; >+ > my $save_temps = $ENV{DEBUG}; > my $verbose = $ENV{VERBOSE}; > >diff --git a/tests/misc/fold b/tests/misc/fold >index ee7279e..d300b32 100755 >--- a/tests/misc/fold >+++ b/tests/misc/fold >@@ -20,9 +20,17 @@ 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; > >+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 +39,49 @@ 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; >+ } >+ >+@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}; > >-my $prog = 'fold'; > my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); > exit $fail; >diff --git a/tests/misc/join b/tests/misc/join >index 8fa0994..2e76ac7 100755 >--- a/tests/misc/join >+++ b/tests/misc/join >@@ -20,10 +20,17 @@ use strict; > > 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"; >+ > # Turn off localization of executable's output. > @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; > >-my $prog = 'join'; >+my $mb_locale = $ENV{LOCALE_FR_UTF8}; >+! defined $mb_locale || $mb_locale eq 'none' >+ and $mb_locale = 'C'; > > my $delim = chr 0247; > sub t_subst ($) >@@ -302,8 +309,46 @@ 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; >+ } >+ 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}; > >diff --git a/tests/misc/pr b/tests/misc/pr >index 0f25e25..fb93d00 100755 >--- a/tests/misc/pr >+++ b/tests/misc/pr >@@ -23,9 +23,16 @@ use strict; > $ENV{PROG} = 'pr'; > my $ME = $ENV{PROG}; > >+my $try = "Try \`$ME --help' for more information.\n"; >+my $inval = "$ME: 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 = $ENV{LOCALE_FR_UTF8}; >+! defined $mb_locale || $mb_locale eq 'none' >+ and $mb_locale = 'C'; >+ > my @Tests = > ( > ['merge-w-tabs', '-m -s -t', >@@ -35,6 +42,46 @@ my @Tests = > {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; >+ } >+ 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}; > >diff --git a/tests/misc/sort b/tests/misc/sort >index 64fb102..7e96cda 100755 >--- a/tests/misc/sort >+++ b/tests/misc/sort >@@ -21,6 +21,9 @@ my $limits = getlimits (); > > my $prog = 'sort'; > >+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; > >@@ -391,13 +394,33 @@ my @Tests = > > # Add _POSIX2_VERSION=199209 to the environment of each test > # that uses an old-style option like +1. >-foreach my $t (@Tests) >+if ($mb_locale ne 'C') > { >- foreach my $e (@$t) >+ # 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) > { >- !ref $e && $e =~ /\+\d/ >- and push (@$t, {ENV=>'_POSIX2_VERSION=199209'}), last; >+ 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; > } > > @Tests = triple_test \@Tests; >diff --git a/tests/misc/unexpand b/tests/misc/unexpand >index d749765..1d03fc4 100755 >--- a/tests/misc/unexpand >+++ b/tests/misc/unexpand >@@ -25,8 +25,15 @@ my $limits = getlimits (); > # 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' >+ and $mb_locale = 'C'; >+ > my $prog = 'unexpand'; > >+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 +99,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; >+ } >+ >+@Tests = triple_test \@Tests; >+ > my $save_temps = $ENV{DEBUG}; > my $verbose = $ENV{VERBOSE}; > >diff --git a/tests/misc/uniq b/tests/misc/uniq >index 5083be5..fcf4b69 100755 >--- a/tests/misc/uniq >+++ b/tests/misc/uniq >@@ -23,9 +23,15 @@ 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 = $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($) > { >@@ -201,13 +207,46 @@ my @Tests = > ['124', '--zero-terminated', {IN=>"a\0a\0b"}, {OUT=>"a\0b\0"}], > ); > >-# Set _POSIX2_VERSION=199209 in the environment of each obs-plus* test. >-foreach my $t (@Tests) >+# Add _POSIX2_VERSION=199209 to the environment of each test >+# that uses an old-style option like +1. >+if ($mb_locale ne 'C') > { >- $t->[0] =~ /^obs-plus/ >- and push @$t, {ENV=>'_POSIX2_VERSION=199209'}; >+ # 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"); >+ 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. >+ >+@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests; >+ > @Tests = add_z_variants \@Tests; > @Tests = triple_test \@Tests; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 821263
: 584158