summaryrefslogtreecommitdiff
path: root/test/misc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-14 05:43:18 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-14 05:43:18 +0000
commit8fb730cf08f18bb4c560c08ebc7a17dfe271f275 (patch)
tree18ba62d3a161c0bbde950f5f196f1eaa1da2c2c1 /test/misc
parent84bd0fb2c6192b737b587ef4fa4ace1685f685bb (diff)
dont fail on locale-based tests, just skip them
Diffstat (limited to 'test/misc')
-rw-r--r--test/misc/tst-fnmatch.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/misc/tst-fnmatch.c b/test/misc/tst-fnmatch.c
index 25471f8e4..d072ef89a 100644
--- a/test/misc/tst-fnmatch.c
+++ b/test/misc/tst-fnmatch.c
@@ -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 *flag_output (int flags);
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 @@ main (void)
/* 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 @@ main (void)
++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);