bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tests erroneously assume


From: Jim Meyering
Subject: Re: Tests erroneously assume
Date: Thu, 01 Apr 2010 11:55:35 +0200

Ludovic Courtès wrote:
> This commit [0] assumes that the ‘en_US.UTF-8’ locale is available.
> This breaks Hydra builds [1] because the only locale available there is C.
>
> I think ‘configure’ should check for this locale, just like it checks
> for a french locale, etc.
>
> [0] 
> http://git.savannah.gnu.org/cgit/grep.git/diff/?id=3220317a428d63a4303ffee0fb45becf835cf1fd&id2=90cc2ba27bd3f368b945f89a60be4220b73baac7
> [1] http://hydra.nixos.org/build/332654

Hi Ludovic,

Thanks for the reminder.  This should fix it.
Can you easily/quickly test this pair of commits?

>From 32d5db19e87a3a52fe67e028d828c136b659660b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 1 Apr 2010 11:45:23 +0200
Subject: [PATCH 1/2] tests: new function, to require an en_US UTF8 locale

* tests/init.cfg (require_en_utf8_locale_): New function.
---
 tests/init.cfg |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tests/init.cfg b/tests/init.cfg
index 6f957b3..8fc8c32 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -38,3 +38,14 @@ require_timeout_()
   ( timeout --version ) > /dev/null 2>&1 \
     || skip_ your system lacks the timeout program
 }
+
+# Some tests would fail without this particular locale.
+# If the locale is not available, just skip the test.
+require_en_utf8_locale_()
+{
+  path_prepend_ .
+  case $(get-mb-cur-max en_US.UTF-8) in
+    [3456]) ;;
+    *) skip_ 'en_US.UTF-8 locale not found' ;;
+  esac
+}
--
1.7.0.3.513.gc8ed0


>From 5a8d2e8737c40068ceeaf63ff8182b5a97da872f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 1 Apr 2010 11:53:54 +0200
Subject: [PATCH 2/2] tests: add explicit requirement for en_US.UTF-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* tests/char-class-multibyte: Use require_en_utf8_locale_,
rather than open-coding it.
* tests/prefix-of-multibyte: Require the locale explicitly.
* tests/fgrep-infloop: Likewise.
This fixes test failures that would arise on systems without
that particular locale.  Reported by Ludovic Courtès.
---
 THANKS                     |    1 +
 tests/char-class-multibyte |    7 ++-----
 tests/fgrep-infloop        |    1 +
 tests/prefix-of-multibyte  |    2 ++
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/THANKS b/THANKS
index c3406a0..18314f8 100644
--- a/THANKS
+++ b/THANKS
@@ -54,6 +54,7 @@ Kazuro Furukawa            <address@hidden>
 Keith Bostic               <address@hidden>
 Krishna Sethuraman         <address@hidden>
 Kurt D Schwehr             <address@hidden>
+Ludovic Courtès            <address@hidden>
 Mark Waite                 <address@hidden>
 Martin P.J. Zinser         <address@hidden>
 Martin Rex                 <address@hidden>
diff --git a/tests/char-class-multibyte b/tests/char-class-multibyte
index 825e3ad..95220ee 100644
--- a/tests/char-class-multibyte
+++ b/tests/char-class-multibyte
@@ -1,12 +1,9 @@
 #!/bin/sh
 # This would segfault for grep-2.6
 : ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ . ../src
+. "$srcdir/init.sh"; path_prepend_ ../src

-case $(get-mb-cur-max en_US.UTF-8) in
-  [3456]) ;;
-  *) skip_ 'UTF-8 locale not found' ;;
-esac
+require_en_utf8_locale_

 printf 'é\n'      > exp1 || framework_failure_
 fail=0
diff --git a/tests/fgrep-infloop b/tests/fgrep-infloop
index 159baca..7491918 100644
--- a/tests/fgrep-infloop
+++ b/tests/fgrep-infloop
@@ -3,6 +3,7 @@
 : ${srcdir=.}
 . "$srcdir/init.sh"; path_prepend_ ../src

+require_en_utf8_locale_
 require_timeout_

 encode() { echo "$1" | tr ABC '\357\274\241'; }
diff --git a/tests/prefix-of-multibyte b/tests/prefix-of-multibyte
index f9e42bf..c077b81 100644
--- a/tests/prefix-of-multibyte
+++ b/tests/prefix-of-multibyte
@@ -3,6 +3,8 @@
 : ${srcdir=.}
 . "$srcdir/init.sh"; path_prepend_ ../src

+require_en_utf8_locale_
+
 encode() { echo "$1" | tr ABC '\357\274\241'; }

 fail=0
--
1.7.0.3.513.gc8ed0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]