svn commit: trunk/uClibc/test/misc

vapier at uclibc.org vapier at uclibc.org
Tue Feb 14 05:43:20 UTC 2006


Author: vapier
Date: 2006-02-13 21:43:18 -0800 (Mon, 13 Feb 2006)
New Revision: 14006

Log:
dont fail on locale-based tests, just skip them

Modified:
   trunk/uClibc/test/misc/tst-fnmatch.c


Changeset:
Modified: trunk/uClibc/test/misc/tst-fnmatch.c
===================================================================
--- trunk/uClibc/test/misc/tst-fnmatch.c	2006-02-14 05:28:21 UTC (rev 14005)
+++ trunk/uClibc/test/misc/tst-fnmatch.c	2006-02-14 05:43:18 UTC (rev 14006)
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <sys/types.h>
 
 
@@ -33,6 +34,16 @@
 static char *escape (const char *str, size_t *reslenp, char **resbuf);
 
 
+int str_isalpha(const char *str)
+{
+	size_t i = strlen(str);
+	while (i--)
+		if (isascii(str[i]) == 0)
+			return 0;
+	return 1;
+}
+
+
 int
 main (void)
 {
@@ -118,6 +129,7 @@
       /* Now run the actual test.  */
       ++ntests;
 
+#ifdef __UCLIBC_HAS_XLOCALE__
       if (setlocale (LC_COLLATE, locale) == NULL
 	  || setlocale (LC_CTYPE, locale) == NULL)
 	{
@@ -125,6 +137,14 @@
 	  ++nfailed;
 	  continue;
 	}
+#else
+      /* skip non-ascii strings */
+      if (!str_isalpha(pattern) || !str_isalpha(input))
+	{
+	  printf("%3d: Skipping test that requires locale support\n", ++nr);
+	  continue;
+	}
+#endif
 
       fnmres = fnmatch (pattern, input, flags_val);
 




More information about the uClibc-cvs mailing list