In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/13f60a098562e1ce7ab09819568bb8a03b617a60?hp=25f3319bf6686f1a93fcce9f236055c69200c9ea>
- Log ----------------------------------------------------------------- commit 13f60a098562e1ce7ab09819568bb8a03b617a60 Author: Karl Williamson <[email protected]> Date: Mon Jul 17 15:40:42 2017 -0600 lib/locale.t: TODO some netbsd defective locales This is part of [perl #131735] The ISO 8859-2 locales on netbsd 7.1 tend to have the defect of thinking an NBSP is a graphic character. This commit tells lib/locale.t to TODO these failures, so that they don't fail our smokes. These are defects in the locale furnished by the vendor, and not a Perl bug. M lib/locale.t commit 7fd05a1ea610c1d9c873e95c52bc397756d11e86 Author: Karl Williamson <[email protected]> Date: Mon Aug 7 10:36:51 2017 -0600 lib/locale.t: Add comments This adds some general comments about the portions of the file that test locales against what the POSIX standard specifies. M lib/locale.t commit 2fb9a6f6b0ec3de0f5eda583d40d7cd1d9bcde7c Author: Karl Williamson <[email protected]> Date: Mon Aug 7 09:57:25 2017 -0600 lib/locale.t: Canonicalize $^O into lowercase This allows the name to be checked for without needing to worry about case. Some patterns used /i, but other things used 'eq'. M lib/locale.t ----------------------------------------------------------------------- Summary of changes: lib/locale.t | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/lib/locale.t b/lib/locale.t index 2ec5fb87a3..cb39d06208 100644 --- a/lib/locale.t +++ b/lib/locale.t @@ -5,9 +5,31 @@ # without using 'eval' as much as possible, which might cloud the issue, the # crucial parts of the code are duplicated in a block for each pragma. +# Unfortunately, many systems have defective locale definitions. This test +# file looks for both perl bugs and bugs in the system's locale definitions. +# It can be difficult to tease apart which is which. For the latter, there +# are tests that are based on the POSIX standard. A character isn't supposed +# to be both a space and graphic, for example. Another example is if a +# character is the uppercase of another, that other should be the lowercase of +# the first. Including tests for these allows you to test for defective +# locales, as described in perllocale. The way this file distinguishes +# between defective locales, and perl bugs is to see what percentage of +# locales fail a given test. If it's a lot, then it's more likely to be a +# perl bug; only a few, those particular locales are likely defective. In +# that case the failing tests are marked TODO. (They should be reported to +# the vendor, however; but it's not perl's problem.) In some cases, this +# script has caused tickets to be filed against perl which turn out to be the +# platform's bug, but a higher percentage of locales are failing than the +# built-in cut-off point. For those platforms, code has been added to +# increase the cut-off, so those platforms don't trigger failing test reports. +# Ideally, the platforms would get fixed and that code would be changed to +# only kick-in when run on versions that are earlier than the fixed one. But, +# this rarely happens in practice. + # To make a TODO test, add the string 'TODO' to its %test_names value my $is_ebcdic = ord("A") == 193; +my $os = lc $^O; no warnings 'locale'; # We test even weird locales; and do some scary things # in ok locales @@ -40,9 +62,9 @@ our $debug = $ENV{PERL_DEBUG_FULL_TEST} // 0; # (There aren't 1000 locales currently in existence, so 99.9 works) # EBCDIC os390 has more locales fail than normal, because it has locales that # move various critical characters like '['. -my $acceptable_failure_percentage = ($^O =~ / ^ ( AIX ) $ /ix) +my $acceptable_failure_percentage = ($os =~ / ^ ( aix ) $ /x) ? 99.9 - : ($^O =~ / ^ ( os390 ) $ /ix) + : ($os =~ / ^ ( os390 ) $ /x) ? 10 : 5; @@ -55,11 +77,12 @@ my %known_bad_locales = ( irix => qr/ ^ (?: cs | hu | sk ) $/x, darwin => qr/ ^ lt_LT.ISO8859 /ix, os390 => qr/ ^ italian /ix, + netbsd => qr/\bISO8859-2\b/i, ); # cygwin isn't returning proper radix length in this locale, but supposedly to # be fixed in later versions. -if ($^O eq 'cygwin' && version->new(($Config{osvers} =~ /^(\d+(?:\.\d+)+)/)[0]) le v2.4.1) { +if ($os eq 'cygwin' && version->new(($Config{osvers} =~ /^(\d+(?:\.\d+)+)/)[0]) le v2.4.1) { $known_bad_locales{'cygwin'} = qr/ ^ ps_AF /ix; } @@ -971,8 +994,8 @@ sub report_result { else { $message //= ""; $message = " ($message)" if $message; - $Known_bad_locale{$i}{$Locale} = 1 if exists $known_bad_locales{$^O} - && $Locale =~ $known_bad_locales{$^O}; + $Known_bad_locale{$i}{$Locale} = 1 if exists $known_bad_locales{$os} + && $Locale =~ $known_bad_locales{$os}; $Problem{$i}{$Locale} = 1; debug "failed $i ($test_names{$i}) with locale '$Locale'$message\n"; } @@ -2539,7 +2562,7 @@ foreach $test_num ($first_locales_test_number..$final_locales_test_number) { $test_num = $final_locales_test_number; -unless ( $^O =~ m!^(dragonfly|openbsd|bitrig|mirbsd)$! ) { +unless ( $os =~ m!^(dragonfly|openbsd|bitrig|mirbsd)$! ) { # perl #115808 use warnings; my $warned = 0; @@ -2684,8 +2707,8 @@ foreach ($first_locales_test_number..$final_locales_test_number) { my @f = sort keys %{ $Problem{$_} }; # Don't list the failures caused by known-bad locales. - if (exists $known_bad_locales{$^O}) { - @f = grep { $_ !~ $known_bad_locales{$^O} } @f; + if (exists $known_bad_locales{$os}) { + @f = grep { $_ !~ $known_bad_locales{$os} } @f; next unless @f; } my $f = join(" ", @f); @@ -2766,7 +2789,7 @@ if ($didwarn) { } } -if (exists $known_bad_locales{$^O} && ! %Known_bad_locale) { +if (exists $known_bad_locales{$os} && ! %Known_bad_locale) { $test_num++; print "ok $test_num $^O no longer has known bad locales # TODO\n"; } -- Perl5 Master Repository
