Pádraig Brady wrote, On 02/27/2013 10:38 PM:
> On 02/12/2013 03:44 PM, Assaf Gordon wrote:
>> I noticed that by running the default test suite ("make check SUBDIRS=."),
>> the majority of uniq tests are skipped:
>> uniq: skipping this test -- no appropriate locale
>> SKIP: tests/misc/uniq.pl
>> PASS: tests/misc/uniq-perf.sh
>>
>> This is due to tests/misc/uniq.pl line 83:
>> 83 # I've only ever triggered the problem in a non-C locale.
>>
>> 84 my $locale = $ENV{LOCALE_FR};
>>
>> 85 ! defined $locale || $locale eq 'none'
>>
>> 86 and CuSkip::skip "$prog: skipping this test -- no appropriate
>> locale\n";
>>
>> which skips the entire suite if there's no french locale defined, even
>> though only one test actually sets the locale.
>>
>> I can have a patch for it, if that's acceptable.
>
> Thanks for noticing that.
> A patch would be much appreciated.
>
Attached a patch to not-skip all uniq tests if french locale is missing.
-gordon
>From 65e47a463e672eddf8f7ed0ca5a9886033e0ef69 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <[email protected]>
Date: Thu, 28 Feb 2013 14:12:52 -0500
Subject: [PATCH] uniq: don't skip all tests when locale is missing
* tests/misc/uniq.pl: Previously, if LOCALE_FR was not defined, all
tests would be skipped. Modified to skip only the relevant test.
---
tests/misc/uniq.pl | 41 ++++++++++++++++++++++++++---------------
1 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/tests/misc/uniq.pl b/tests/misc/uniq.pl
index e3873b5..4fe1357 100755
--- a/tests/misc/uniq.pl
+++ b/tests/misc/uniq.pl
@@ -80,23 +80,8 @@ sub add_z_variants($)
return @new;
}
-# I've only ever triggered the problem in a non-C locale.
-my $locale = $ENV{LOCALE_FR};
-! defined $locale || $locale eq 'none'
- and CuSkip::skip "$prog: skipping this test -- no appropriate locale\n";
-
-# See if isblank returns true for nbsp.
-my $x = qx!env printf '\xa0'| LC_ALL=$locale tr '[:blank:]' x!;
-# If so, expect just one line of output in the schar test.
-# Otherwise, expect two.
-my $in = " y z\n\xa0 y z\n";
-my $schar_exp = $x eq 'x' ? " y z\n" : $in;
-
my @Tests =
(
- # Test for a subtle, system-and-locale-dependent bug in uniq.
- ['schar', '-f1', {IN => $in}, {OUT => $schar_exp},
- {ENV => "LC_ALL=$locale"}],
['1', '', {IN=>''}, {OUT=>''}],
['2', '', {IN=>"a\na\n"}, {OUT=>"a\n"}],
['3', '', {IN=>"a\na"}, {OUT=>"a\n"}],
@@ -205,6 +190,32 @@ my @Tests =
['127', '--ignore-case', {IN=>"A\na\n"}, {OUT=>"A\n"}],
);
+
+# Locale related tests
+
+my $locale = $ENV{LOCALE_FR};
+if ( defined $locale && $locale ne 'none' )
+ {
+ # I've only ever triggered the problem in a non-C locale.
+
+ # See if isblank returns true for nbsp.
+ my $x = qx!env printf '\xa0'| LC_ALL=$locale tr '[:blank:]' x!;
+ # If so, expect just one line of output in the schar test.
+ # Otherwise, expect two.
+ my $in = " y z\n\xa0 y z\n";
+ my $schar_exp = $x eq 'x' ? " y z\n" : $in;
+
+ my @Locale_Tests =
+ (
+ # Test for a subtle, system-and-locale-dependent bug in uniq.
+ ['schar', '-f1', {IN => $in}, {OUT => $schar_exp},
+ {ENV => "LC_ALL=$locale"}]
+ );
+
+ push @Tests, @Locale_Tests;
+ }
+
+
# Set _POSIX2_VERSION=199209 in the environment of each obs-plus* test.
foreach my $t (@Tests)
{
--
1.7.7.4