bug-gnulib
[Top][All Lists]
Advanced

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

Re: xstrtol: fix test failure on mingw


From: Bruno Haible
Subject: Re: xstrtol: fix test failure on mingw
Date: Sat, 26 Apr 2008 14:15:27 +0200
User-agent: KMail/1.5.4

Ralf Wildenhues wrote:
> > > > ! LC_ALL=C tr -d '\r' < t-xstrtoimax.tmp > t-xstrtoimax.xo
> > > I hear that there really do exist systems in actual use
> > > on which tr still does not honor backslash-escapes like \r and \n.
> > 
> > Which platforms, please? (I use the similar idiom in more than 200 files in
> > gettext. So I need to know the reasons.)
> 
> Solaris 10 /usr/ucb/tr.  Not likely to be early in PATH, but hey, people
> do all kinds of weird things to their path.  ;-)

You're right. Bad luck. I added a workaround like this:


2008-04-26  Bruno Haible  <address@hidden>

        * tests/test-xstrtol.sh: Work around limitation of an old 'tr' program
        on Solaris.
        * tests/test-xstrtoimax.sh: Likewise.
        * tests/test-xstrtoumax.sh: Likewise.
        Reported by Ralf Wildenhues <address@hidden>.

*** tests/test-xstrtoimax.sh.orig       2008-04-26 14:13:23.000000000 +0200
--- tests/test-xstrtoimax.sh    2008-04-26 14:12:19.000000000 +0200
***************
*** 19,26 ****
  ./test-xstrtoimax${EXEEXT} 010 >> t-xstrtoimax.tmp 2>&1 || result=1
  ./test-xstrtoimax${EXEEXT} MiB >> t-xstrtoimax.tmp 2>&1 || result=1
  
  # normalize output
! LC_ALL=C tr -d '\r' < t-xstrtoimax.tmp > t-xstrtoimax.xo
  mv t-xstrtoimax.xo t-xstrtoimax.tmp
  
  # compare expected output
--- 19,34 ----
  ./test-xstrtoimax${EXEEXT} 010 >> t-xstrtoimax.tmp 2>&1 || result=1
  ./test-xstrtoimax${EXEEXT} MiB >> t-xstrtoimax.tmp 2>&1 || result=1
  
+ # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+ # does not understand '\r'.
+ if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+   cr='\015'
+ else
+   cr='\r'
+ fi
+ 
  # normalize output
! LC_ALL=C tr -d "$cr" < t-xstrtoimax.tmp > t-xstrtoimax.xo
  mv t-xstrtoimax.xo t-xstrtoimax.tmp
  
  # compare expected output
*** tests/test-xstrtol.sh.orig  2008-04-26 14:13:23.000000000 +0200
--- tests/test-xstrtol.sh       2008-04-26 14:12:20.000000000 +0200
***************
*** 31,38 ****
  ./test-xstrtoul${EXEEXT} 010 >> t-xstrtol.tmp 2>&1 || result=1
  ./test-xstrtoul${EXEEXT} MiB >> t-xstrtol.tmp 2>&1 || result=1
  
  # normalize output
! LC_ALL=C tr -d '\r' < t-xstrtol.tmp > t-xstrtol.xo
  mv t-xstrtol.xo t-xstrtol.tmp
  
  # compare expected output
--- 31,46 ----
  ./test-xstrtoul${EXEEXT} 010 >> t-xstrtol.tmp 2>&1 || result=1
  ./test-xstrtoul${EXEEXT} MiB >> t-xstrtol.tmp 2>&1 || result=1
  
+ # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+ # does not understand '\r'.
+ if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+   cr='\015'
+ else
+   cr='\r'
+ fi
+ 
  # normalize output
! LC_ALL=C tr -d "$cr" < t-xstrtol.tmp > t-xstrtol.xo
  mv t-xstrtol.xo t-xstrtol.tmp
  
  # compare expected output
*** tests/test-xstrtoumax.sh.orig       2008-04-26 14:13:23.000000000 +0200
--- tests/test-xstrtoumax.sh    2008-04-26 14:12:20.000000000 +0200
***************
*** 19,26 ****
  ./test-xstrtoumax${EXEEXT} 010 >> t-xstrtoumax.tmp 2>&1 || result=1
  ./test-xstrtoumax${EXEEXT} MiB >> t-xstrtoumax.tmp 2>&1 || result=1
  
  # normalize output
! LC_ALL=C tr -d '\r' < t-xstrtoumax.tmp > t-xstrtoumax.xo
  mv t-xstrtoumax.xo t-xstrtoumax.tmp
  
  # compare expected output
--- 19,34 ----
  ./test-xstrtoumax${EXEEXT} 010 >> t-xstrtoumax.tmp 2>&1 || result=1
  ./test-xstrtoumax${EXEEXT} MiB >> t-xstrtoumax.tmp 2>&1 || result=1
  
+ # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+ # does not understand '\r'.
+ if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+   cr='\015'
+ else
+   cr='\r'
+ fi
+ 
  # normalize output
! LC_ALL=C tr -d "$cr" < t-xstrtoumax.tmp > t-xstrtoumax.xo
  mv t-xstrtoumax.xo t-xstrtoumax.tmp
  
  # compare expected output





reply via email to

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