This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Some fixes to the locale tests


[Petter Reinholdtsen]
> Here is a small patch to improve error reporting and make sure
> comments are ignored in the data files for tst-fmon and tst-numeric.
> 
> 2003-04-30  Petter Reinholdtsen  <pere@hungry.com>
> 
> 	* tst-fmon.c: Report name of locale if setlocale() fails.
> 	* tst-numeric.c: Likewise.
> 
> 	* tst-fmon.sh: Ignore lines starting with hash '#' in the data file.
> 	* tst-numeric.sh: Likewise.

Roland suggested some improvements.  Here is a new and shorter
version.

Index: localedata/tst-fmon.c
===================================================================
RCS file: /cvs/glibc/libc/localedata/tst-fmon.c,v
retrieving revision 1.5
diff -u -3 -p -u -r1.5 tst-fmon.c
--- localedata/tst-fmon.c	6 Jul 2001 04:55:34 -0000	1.5
+++ localedata/tst-fmon.c	30 Apr 2003 07:30:43 -0000
@@ -46,7 +46,7 @@ main (int argc, char *argv[])
 
   if (setlocale (LC_MONETARY, argv[1]) == NULL)
     {
-      perror ("setlocale");
+      fprintf (stderr, "setlocale(LC_MONETARY, \"%s\"): %m", argv[1]);
       exit (EXIT_SETLOCALE);
     }
   /* This is locale-dependent! see setlocale(3) for details */
Index: localedata/tst-numeric.c
===================================================================
RCS file: /cvs/glibc/libc/localedata/tst-numeric.c,v
retrieving revision 1.1
diff -u -3 -p -u -r1.1 tst-numeric.c
--- localedata/tst-numeric.c	27 Apr 2003 09:02:25 -0000	1.1
+++ localedata/tst-numeric.c	30 Apr 2003 07:30:43 -0000
@@ -51,7 +51,7 @@ main (int argc, char *argv[])
 
   if (setlocale (LC_ALL, argv[1]) == NULL)
     {
-      perror ("setlocale");
+      fprintf (stderr, "setlocale(LC_ALL, \"%s\"): %m", argv[1]);
       exit (EXIT_SETLOCALE);
     }
 
Index: localedata/tst-fmon.sh
===================================================================
RCS file: /cvs/glibc/libc/localedata/tst-fmon.sh,v
retrieving revision 1.12
diff -u -3 -p -u -r1.12 tst-fmon.sh
--- localedata/tst-fmon.sh	6 Jul 2001 04:55:34 -0000	1.12
+++ localedata/tst-fmon.sh	30 Apr 2003 07:30:43 -0000
@@ -41,6 +41,7 @@ done
 # Run the tests.
 # There's a TAB for IFS
 while IFS="	" read locale format value expect; do
+    case "$locale" in '#'*) continue ;; esac
     if [ -n "$format" ]; then
 	LOCPATH=${common_objpfx}localedata \
 	GCONV_PATH=${common_objpfx}/iconvdata \
Index: localedata/tst-numeric.sh
===================================================================
RCS file: /cvs/glibc/libc/localedata/tst-numeric.sh,v
retrieving revision 1.1
diff -u -3 -p -u -r1.1 tst-numeric.sh
--- localedata/tst-numeric.sh	27 Apr 2003 09:02:25 -0000	1.1
+++ localedata/tst-numeric.sh	30 Apr 2003 07:30:43 -0000
@@ -27,6 +27,7 @@ datafile=$3
 # Run the tests.
 # There's a TAB for IFS
 while IFS="	" read locale format value expect; do
+    case "$locale" in '#'*) continue ;; esac
     if [ -n "$format" ]; then
 	LOCPATH=${common_objpfx}localedata \
 	GCONV_PATH=${common_objpfx}/iconvdata \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]