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]

patch: Clean up in locale test code


Here are a few patches to clean up the locale test code.

2003-06-15  Petter Reinholdtsen  <pere@hungry.com>

	* tst-fmon.c (main): Remove unused variable 'monval'.

	* tst-fmon.sh: Make sure all tests are executed before an error
	code is reported to make.
	* tst-numeric.sh: Likewise.

Index: localedata/tst-fmon.c
===================================================================
RCS file: /cvs/glibc/libc/localedata/tst-fmon.c,v
retrieving revision 1.6
diff -u -3 -p -u -r1.6 tst-fmon.c
--- localedata/tst-fmon.c	1 May 2003 07:22:00 -0000	1.6
+++ localedata/tst-fmon.c	15 Jun 2003 17:11:41 -0000
@@ -42,15 +42,12 @@ int
 main (int argc, char *argv[])
 {
   char *s = malloc (201);
-  double monval;
 
   if (setlocale (LC_MONETARY, argv[1]) == NULL)
     {
       fprintf (stderr, "setlocale(LC_MONETARY, \"%s\"): %m\n", argv[1]);
       exit (EXIT_SETLOCALE);
     }
-  /* This is locale-dependent! see setlocale(3) for details */
-  monval = strtod (argv[3], NULL);
 
   if (strfmon (s, 200, argv[2], (double) atof (argv[3])) == -1)
     {
Index: localedata/tst-fmon.sh
===================================================================
RCS file: /cvs/glibc/libc/localedata/tst-fmon.sh,v
retrieving revision 1.13
diff -u -3 -p -u -r1.13 tst-fmon.sh
--- localedata/tst-fmon.sh	1 May 2003 07:22:20 -0000	1.13
+++ localedata/tst-fmon.sh	15 Jun 2003 17:11:41 -0000
@@ -40,24 +40,25 @@ done
 
 # Run the tests.
 # There's a TAB for IFS
+errcode=0
 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 \
-	${run_program_prefix} ${common_objpfx}localedata/tst-fmon \
-	    "$locale" "$format" "$value" "$expect"
-	if [ $? -eq 0 ]; then
+	if LOCPATH=${common_objpfx}localedata \
+	   GCONV_PATH=${common_objpfx}/iconvdata \
+	   ${run_program_prefix} ${common_objpfx}localedata/tst-fmon \
+	   "$locale" "$format" "$value" "$expect" ; then
 	    echo "Locale: \"${locale}\" Format: \"${format}\"" \
 		 "Value: \"${value}\" Expect: \"${expect}\"  passed"
 	else
+	    errcode=$?
 	    echo "Locale: \"${locale}\" Format: \"${format}\"" \
 		 "Value: \"${value}\" Expect: \"${expect}\"    failed"
 	fi
     fi
 done < $datafile
 
-exit $?
+exit $errcode
 # Local Variables:
 #  mode:shell-script
 # End:
Index: localedata/tst-numeric.sh
===================================================================
RCS file: /cvs/glibc/libc/localedata/tst-numeric.sh,v
retrieving revision 1.2
diff -u -3 -p -u -r1.2 tst-numeric.sh
--- localedata/tst-numeric.sh	1 May 2003 07:22:20 -0000	1.2
+++ localedata/tst-numeric.sh	15 Jun 2003 17:11:41 -0000
@@ -26,24 +26,26 @@ datafile=$3
 
 # Run the tests.
 # There's a TAB for IFS
+errcode=0
 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 \
-	${run_program_prefix} ${common_objpfx}localedata/tst-numeric \
+	if LOCPATH=${common_objpfx}localedata \
+	    GCONV_PATH=${common_objpfx}/iconvdata \
+	    ${run_program_prefix} ${common_objpfx}localedata/tst-numeric \
 	    "$locale" "$format" "$value" "$expect"
-	if [ $? -eq 0 ]; then
+	then
 	    echo "Locale: \"${locale}\" Format: \"${format}\"" \
 		 "Value: \"${value}\" Expect: \"${expect}\"  passed"
 	else
+	    errcode=$?
 	    echo "Locale: \"${locale}\" Format: \"${format}\"" \
 		 "Value: \"${value}\" Expect: \"${expect}\"    failed"
 	fi
     fi
 done < $datafile
 
-exit $?
+exit $errcode
 # Local Variables:
 #  mode:shell-script
 # End:


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