bug-gnulib
[Top][All Lists]
Advanced

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

xstrtol: fix test failure on mingw


From: Bruno Haible
Subject: xstrtol: fix test failure on mingw
Date: Tue, 22 Apr 2008 00:48:40 +0200
User-agent: KMail/1.5.4

The tests test-xstrtol.sh, test-xstrtoimax.sh, test-xstrtoumax.sh, for two
reasons:
  1) The test wants to filter out the program name from the error message,
     but this does not work on mingw: when the error message is
       c:\work space\gltests\test-xstrtol.exe: invalid X argument
     it is no easy to determine where the file name end and where the error
     message begins. In particular, searching for the first colon does not work.
  2) The output has CRLFs, but is compared against expected output with only 
NLs.

This fixes it.


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

        Fix test failures on mingw.
        * tests/test-xstrtol.c (print_no_progname): New function.
        (main): Install it in error_print_progname hook.
        * tests/test-xstrtol.sh: Convert CR/LF to NL in output.
        * tests/test-xstrtoimax.sh: Likewise.
        * tests/test-xstrtoumax.sh: Likewise.

*** tests/test-xstrtol.c.orig   2008-04-22 00:41:25.000000000 +0200
--- tests/test-xstrtol.c        2008-04-22 00:25:31.000000000 +0200
***************
*** 1,6 ****
  /* Test of xstrtol module.
     Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
!    2006, 2007 Free Software Foundation, Inc.
  
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
--- 1,6 ----
  /* Test of xstrtol module.
     Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
!    2006, 2007, 2008 Free Software Foundation, Inc.
  
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
***************
*** 32,37 ****
--- 32,43 ----
  
  char *program_name;
  
+ /* Don't show the program name in error messages.  */
+ static void
+ print_no_progname (void)
+ {
+ }
+ 
  int
  main (int argc, char **argv)
  {
***************
*** 39,44 ****
--- 45,52 ----
    int i;
  
    program_name = argv[0];
+   error_print_progname = print_no_progname;
+ 
    for (i = 1; i < argc; i++)
      {
        char *p;
*** tests/test-xstrtoimax.sh.orig       2008-04-22 00:41:25.000000000 +0200
--- tests/test-xstrtoimax.sh    2008-04-22 00:39:23.000000000 +0200
***************
*** 20,26 ****
  ./test-xstrtoimax${EXEEXT} MiB >> t-xstrtoimax.tmp 2>&1 || result=1
  
  # normalize output
! sed -e 's/^[^:]*: //' < t-xstrtoimax.tmp > t-xstrtoimax.xo
  mv t-xstrtoimax.xo t-xstrtoimax.tmp
  
  # compare expected output
--- 20,26 ----
  ./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
*** tests/test-xstrtol.sh.orig  2008-04-22 00:41:25.000000000 +0200
--- tests/test-xstrtol.sh       2008-04-22 00:38:41.000000000 +0200
***************
*** 32,38 ****
  ./test-xstrtoul${EXEEXT} MiB >> t-xstrtol.tmp 2>&1 || result=1
  
  # normalize output
! sed -e 's/^[^:]*: //' < t-xstrtol.tmp > t-xstrtol.xo
  mv t-xstrtol.xo t-xstrtol.tmp
  
  # compare expected output
--- 32,38 ----
  ./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
*** tests/test-xstrtoumax.sh.orig       2008-04-22 00:41:25.000000000 +0200
--- tests/test-xstrtoumax.sh    2008-04-22 00:39:02.000000000 +0200
***************
*** 20,26 ****
  ./test-xstrtoumax${EXEEXT} MiB >> t-xstrtoumax.tmp 2>&1 || result=1
  
  # normalize output
! sed -e 's/^[^:]*: //' < t-xstrtoumax.tmp > t-xstrtoumax.xo
  mv t-xstrtoumax.xo t-xstrtoumax.tmp
  
  # compare expected output
--- 20,26 ----
  ./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





reply via email to

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