aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-11-21 09:20:45 +0000
committerUlrich Drepper <drepper@redhat.com>2003-11-21 09:20:45 +0000
commit53f9084e3f565d62f2a1293a72cb838b759382ce (patch)
treed12244cbe15795af699f7c656e9fcede50e3c97d
parentc13c99fa92bff8320d2af23717c3e4d656923932 (diff)
downloadglibc-53f9084e3f565d62f2a1293a72cb838b759382ce.tar
glibc-53f9084e3f565d62f2a1293a72cb838b759382ce.tar.gz
glibc-53f9084e3f565d62f2a1293a72cb838b759382ce.tar.bz2
glibc-53f9084e3f565d62f2a1293a72cb838b759382ce.zip
Update.
2003-11-21 Ulrich Drepper <drepper@redhat.com> * Makefile: Add rules to build and run tst-cond12. * tst-cond12.c: New file.
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/tst-cond12.c184
-rw-r--r--posix/bug-regex19.c303
-rw-r--r--posix/ptestcases.h2
-rw-r--r--posix/tst-rxspencer.c44
6 files changed, 465 insertions, 75 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 2af37b8914..e0c329d222 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2003-11-21 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile: Add rules to build and run tst-cond12.
+ * tst-cond12.c: New file.
+
2003-11-17 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/configure.in: Make missing forced unwind support
diff --git a/nptl/Makefile b/nptl/Makefile
index f3ba929c31..ce1b5fe0e3 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -193,7 +193,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
tst-mutex7 tst-mutex8 tst-mutex9 \
tst-spin1 tst-spin2 tst-spin3 \
tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
- tst-cond8 tst-cond9 tst-cond10 tst-cond11 \
+ tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 \
tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
tst-rwlock11 tst-rwlock12 \
diff --git a/nptl/tst-cond12.c b/nptl/tst-cond12.c
new file mode 100644
index 0000000000..256c8a9b9e
--- /dev/null
+++ b/nptl/tst-cond12.c
@@ -0,0 +1,184 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static char fname[] = "/tmp/tst-cond12-XXXXXX";
+static int fd;
+
+
+static void
+prepare (void)
+{
+ fd = mkstemp (fname);
+ if (fd == -1)
+ {
+ printf ("mkstemp failed: %m\n");
+ exit (1);
+ }
+ add_temp_file (fname);
+ if (ftruncate (fd, 1000) < 0)
+ {
+ printf ("ftruncate failed: %m\n");
+ exit (1);
+ }
+}
+#define PREPARE(argc, argv) prepare ()
+
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
+
+static int
+do_test (void)
+{
+ struct
+ {
+ pthread_mutex_t m;
+ pthread_cond_t c;
+ int var;
+ } *p = mmap (NULL, sizeof (*p), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+ if (p == MAP_FAILED)
+ {
+ printf ("initial mmap failed: %m\n");
+ return 1;
+ }
+
+ pthread_mutexattr_t ma;
+ if (pthread_mutexattr_init (&ma) != 0)
+ {
+ puts ("mutexattr_init failed");
+ return 1;
+ }
+ if (pthread_mutexattr_setpshared (&ma, 1) != 0)
+ {
+ puts ("mutexattr_setpshared failed");
+ return 1;
+ }
+ if (pthread_mutex_init (&p->m, &ma) != 0)
+ {
+ puts ("mutex_init failed");
+ return 1;
+ }
+ if (pthread_mutexattr_destroy (&ma) != 0)
+ {
+ puts ("mutexattr_destroy failed");
+ return 1;
+ }
+
+ pthread_condattr_t ca;
+ if (pthread_condattr_init (&ca) != 0)
+ {
+ puts ("condattr_init failed");
+ return 1;
+ }
+ if (pthread_condattr_setpshared (&ca, 1) != 0)
+ {
+ puts ("condattr_setpshared failed");
+ return 1;
+ }
+ if (pthread_cond_init (&p->c, &ca) != 0)
+ {
+ puts ("mutex_init failed");
+ return 1;
+ }
+ if (pthread_condattr_destroy (&ca) != 0)
+ {
+ puts ("condattr_destroy failed");
+ return 1;
+ }
+
+ if (pthread_mutex_lock (&p->m) != 0)
+ {
+ puts ("initial mutex_lock failed");
+ return 1;
+ }
+
+ p->var = 42;
+
+ pid_t pid = fork ();
+ if (pid == -1)
+ {
+ printf ("fork failed: %m\n");
+ return 1;
+ }
+
+ if (pid == 0)
+ {
+ void *oldp = p;
+ p = mmap (NULL, sizeof (*p), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+
+ if (p == oldp)
+ {
+ puts ("child: mapped to same address");
+ kill (getppid (), SIGKILL);
+ exit (1);
+ }
+
+ munmap (oldp, sizeof (*p));
+
+ if (pthread_mutex_lock (&p->m) != 0)
+ {
+ puts ("child: mutex_lock failed");
+ kill (getppid (), SIGKILL);
+ exit (1);
+ }
+
+ p->var = 0;
+
+ if (pthread_cond_broadcast (&p->c) != 0)
+ {
+ puts ("child: cond_broadcast failed");
+ kill (getppid (), SIGKILL);
+ exit (1);
+ }
+
+ if (pthread_mutex_unlock (&p->m) != 0)
+ {
+ puts ("child: mutex_unlock failed");
+ kill (getppid (), SIGKILL);
+ exit (1);
+ }
+
+ exit (0);
+ }
+
+ do
+ pthread_cond_wait (&p->c, &p->m);
+ while (p->var != 0);
+
+ if (TEMP_FAILURE_RETRY (waitpid (pid, NULL, 0)) != pid)
+ {
+ printf ("waitpid failed: %m\n");
+ kill (pid, SIGKILL);
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/posix/bug-regex19.c b/posix/bug-regex19.c
index fb870338c3..53d5640c63 100644
--- a/posix/bug-regex19.c
+++ b/posix/bug-regex19.c
@@ -26,87 +26,276 @@
#include <string.h>
#include <locale.h>
-static struct
+#define BRE RE_SYNTAX_POSIX_BASIC
+#define ERE RE_SYNTAX_POSIX_EXTENDED
+
+static struct test_s
{
int syntax;
const char *pattern;
const char *string;
int start, res;
} tests[] = {
- /* \xc3\x84 LATIN CAPITAL LETTER A WITH DIAERESIS
- \xc3\x96 LATIN CAPITAL LETTER O WITH DIAERESIS
- \xe2\x80\x94 EM DASH */
- /* Should not match. */
- {RE_SYNTAX_POSIX_BASIC, "\\<A", "aOAA", 0, -1},
- {RE_SYNTAX_POSIX_BASIC, "\\<A", "aOAA", 2, -1},
- {RE_SYNTAX_POSIX_BASIC, "A\\>", "aAAO", 1, -1},
- {RE_SYNTAX_POSIX_BASIC, "\\bA", "aOAA", 0, -1},
- {RE_SYNTAX_POSIX_BASIC, "\\bA", "aOAA", 2, -1},
- {RE_SYNTAX_POSIX_BASIC, "A\\b", "aAAO", 1, -1},
- {RE_SYNTAX_POSIX_BASIC, "\\<\xc3\x84", "a\xc3\x96\xc3\x84\xc3\x84", 0, -1},
- {RE_SYNTAX_POSIX_BASIC, "\\<\xc3\x84", "a\xc3\x96\xc3\x84\xc3\x84", 3, -1},
- {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\>", "a\xc3\x84\xc3\x84\xc3\x96", 1, -1},
-#if 0
- /* XXX these 2 tests still fail. */
- {RE_SYNTAX_POSIX_BASIC, "\\b\xc3\x84", "a\xc3\x96\xc3\x84\xc3\x84", 0, -1},
- {RE_SYNTAX_POSIX_BASIC, "\\b\xc3\x84", "a\xc3\x96\xc3\x84\xc3\x84", 3, -1},
-#endif
- {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\b", "a\xc3\x84\xc3\x84\xc3\x96", 1, -1},
- /* Should match. */
- {RE_SYNTAX_POSIX_BASIC, "\\<A", "AA", 0, 0},
- {RE_SYNTAX_POSIX_BASIC, "\\<A", "a-AA", 2, 2},
- {RE_SYNTAX_POSIX_BASIC, "A\\>", "aAA-", 1, 2},
- {RE_SYNTAX_POSIX_BASIC, "A\\>", "aAA", 1, 2},
- {RE_SYNTAX_POSIX_BASIC, "\\bA", "AA", 0, 0},
- {RE_SYNTAX_POSIX_BASIC, "\\bA", "a-AA", 2, 2},
- {RE_SYNTAX_POSIX_BASIC, "A\\b", "aAA-", 1, 2},
- {RE_SYNTAX_POSIX_BASIC, "A\\b", "aAA", 1, 2},
- {RE_SYNTAX_POSIX_BASIC, "\\<\xc3\x84", "\xc3\x84\xc3\x84", 0, 0},
- {RE_SYNTAX_POSIX_BASIC, "\\<\xc3\x84", "a\xe2\x80\x94\xc3\x84\xc3\x84", 4, 4},
- {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\>", "a\xc3\x84\xc3\x84\xe2\x80\x94", 1, 3},
- {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\>", "a\xc3\x84\xc3\x84", 1, 3},
- {RE_SYNTAX_POSIX_BASIC, "\\b\xc3\x84", "\xc3\x84\xc3\x84", 0, 0},
- {RE_SYNTAX_POSIX_BASIC, "\\b\xc3\x84", "a\xe2\x80\x94\xc3\x84\xc3\x84", 4, 4},
- {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\b", "a\xc3\x84\xc3\x84\xe2\x80\x94", 1, 3},
- {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\b", "a\xc3\x84\xc3\x84", 1, 3}
+ {BRE, "\\<A", "CBAA", 0, -1},
+ {BRE, "\\<A", "CBAA", 2, -1},
+ {BRE, "A\\>", "CAAB", 1, -1},
+ {BRE, "\\bA", "CBAA", 0, -1},
+ {BRE, "\\bA", "CBAA", 2, -1},
+ {BRE, "A\\b", "CAAB", 1, -1},
+ {BRE, "\\<A", "AA", 0, 0},
+ {BRE, "\\<A", "C-AA", 2, 2},
+ {BRE, "A\\>", "CAA-", 1, 2},
+ {BRE, "A\\>", "CAA", 1, 2},
+ {BRE, "\\bA", "AA", 0, 0},
+ {BRE, "\\bA", "C-AA", 2, 2},
+ {BRE, "A\\b", "CAA-", 1, 2},
+ {BRE, "A\\b", "CAA", 1, 2},
+ {ERE, "\\b(A|!|.B)", "A=AC", 0, 0},
+ {ERE, "\\b(A|!|.B)", "=AC", 0, 1},
+ {ERE, "\\b(A|!|.B)", "!AC", 0, 1},
+ {ERE, "\\b(A|!|.B)", "=AB", 0, 1},
+ {ERE, "\\b(A|!|.B)", "DA!C", 0, 2},
+ {ERE, "\\b(A|!|.B)", "=CB", 0, 1},
+ {ERE, "\\b(A|!|.B)", "!CB", 0, 1},
+ {ERE, "\\b(A|!|.B)", "D,B", 0, 1},
+ {ERE, "\\b(A|!|.B)", "!.C", 0, -1},
+ {ERE, "\\b(A|!|.B)", "BCB", 0, -1},
+ {ERE, "(A|\\b)(A|B|C)", "DAAD", 0, 1},
+ {ERE, "(A|\\b)(A|B|C)", "DABD", 0, 1},
+ {ERE, "(A|\\b)(A|B|C)", "AD", 0, 0},
+ {ERE, "(A|\\b)(A|B|C)", "C!", 0, 0},
+ {ERE, "(A|\\b)(A|B|C)", "D,B", 0, 2},
+ {ERE, "(A|\\b)(A|B|C)", "DA?A", 0, 3},
+ {ERE, "(A|\\b)(A|B|C)", "BBC", 0, 0},
+ {ERE, "(A|\\b)(A|B|C)", "DA", 0, -1},
+ {ERE, "(!|\\b)(!|=|~)", "A!=\\", 0, 1},
+ {ERE, "(!|\\b)(!|=|~)", "/!=A", 0, 1},
+ {ERE, "(!|\\b)(!|=|~)", "A=A", 0, 1},
+ {ERE, "(!|\\b)(!|=|~)", "==!=", 0, 2},
+ {ERE, "(!|\\b)(!|=|~)", "==C~", 0, 3},
+ {ERE, "(!|\\b)(!|=|~)", "=~=", 0, -1},
+ {ERE, "(!|\\b)(!|=|~)", "~!", 0, -1},
+ {ERE, "(!|\\b)(!|=|~)", "~=~", 0, -1},
+ {ERE, "(\\b|A.)[ABC]", "AC", 0, 0},
+ {ERE, "(\\b|A.)[ABC]", "=A", 0, 1},
+ {ERE, "(\\b|A.)[ABC]", "DACC", 0, 1},
+ {ERE, "(\\b|A.)[A~C]", "AC", 0, 0},
+ {ERE, "(\\b|A.)[A~C]", "=A", 0, 1},
+ {ERE, "(\\b|A.)[A~C]", "DACC", 0, 1},
+ {ERE, "(\\b|A.)[A~C]", "B!A=", 0, 2},
+ {ERE, "(\\b|A.)[A~C]", "B~C", 0, 1},
+ {ERE, ".\\b.", "AA~", 0, 1},
+ {ERE, ".\\b.", "=A=", 0, 0},
+ {ERE, ".\\b.", "==", 0, -1},
+ {ERE, ".\\b.", "ABA", 0, -1},
+ {ERE, "\\<(A|!|.B)", "A=AC", 0, 0},
+ {ERE, "\\<(A|!|.B)", "=AC", 0, 1},
+ {ERE, "\\<(A|!|.B)", "!AC", 0, 1},
+ {ERE, "\\<(A|!|.B)", "=AB", 0, 1},
+ {ERE, "\\<(A|!|.B)", "=CB", 0, 1},
+ {ERE, "\\<(A|!|.B)", "!CB", 0, 1},
+ {ERE, "\\<(A|!|.B)", "DA!C", 0, -1},
+ {ERE, "\\<(A|!|.B)", "D,B", 0, -1},
+ {ERE, "\\<(A|!|.B)", "!.C", 0, -1},
+ {ERE, "\\<(A|!|.B)", "BCB", 0, -1},
+ {ERE, "(A|\\<)(A|B|C)", "DAAD", 0, 1},
+ {ERE, "(A|\\<)(A|B|C)", "DABD", 0, 1},
+ {ERE, "(A|\\<)(A|B|C)", "AD", 0, 0},
+ {ERE, "(A|\\<)(A|B|C)", "C!", 0, 0},
+ {ERE, "(A|\\<)(A|B|C)", "D,B", 0, 2},
+ {ERE, "(A|\\<)(A|B|C)", "DA?A", 0, 3},
+ {ERE, "(A|\\<)(A|B|C)", "BBC", 0, 0},
+ {ERE, "(A|\\<)(A|B|C)", "DA", 0, -1},
+ {ERE, "(!|\\<)(!|=|~)", "A!=\\", 0, 1},
+ {ERE, "(!|\\<)(!|=|~)", "/!=A", 0, 1},
+ {ERE, "(!|\\<)(!|=|~)", "==!=", 0, 2},
+ {ERE, "(!|\\<)(!|=|~)", "==C~", 0, -1},
+ {ERE, "(!|\\<)(!|=|~)", "A=A", 0, -1},
+ {ERE, "(!|\\<)(!|=|~)", "=~=", 0, -1},
+ {ERE, "(!|\\<)(!|=|~)", "~!", 0, -1},
+ {ERE, "(!|\\<)(!|=|~)", "~=~", 0, -1},
+ {ERE, "(\\<|A.)[ABC]", "AC", 0, 0},
+ {ERE, "(\\<|A.)[ABC]", "=A", 0, 1},
+ {ERE, "(\\<|A.)[ABC]", "DACC", 0, 1},
+ {ERE, "(\\<|A.)[A~C]", "AC", 0, 0},
+ {ERE, "(\\<|A.)[A~C]", "=A", 0, 1},
+ {ERE, "(\\<|A.)[A~C]", "DACC", 0, 1},
+ {ERE, "(\\<|A.)[A~C]", "B!A=", 0, 2},
+ {ERE, "(\\<|A.)[A~C]", "B~C", 0, 2},
+ {ERE, ".\\<.", "=A=", 0, 0},
+ {ERE, ".\\<.", "AA~", 0, -1},
+ {ERE, ".\\<.", "==", 0, -1},
+ {ERE, ".\\<.", "ABA", 0, -1},
+ {ERE, ".\\B.", "ABA", 0, 0},
+ {ERE, ".\\B.", "=BDC", 0, 1},
+ {ERE, ".(\\b|\\B).", "=~AB", 0, 1},
+ {ERE, ".(\\b|\\B).", "A=C", 0, 0},
+ {ERE, ".(\\b|\\B).", "ABC", 0, 0},
+ {ERE, ".(\\b|\\B).", "=~\\!", 0, -1},
};
int
-main (void)
+do_one_test (const struct test_s *test, const char *fail)
{
- struct re_pattern_buffer regbuf;
+ int res;
const char *err;
+ struct re_pattern_buffer regbuf;
+
+ re_set_syntax (test->syntax);
+ memset (&regbuf, '\0', sizeof (regbuf));
+ err = re_compile_pattern (test->pattern, strlen (test->pattern),
+ &regbuf);
+ if (err != NULL)
+ {
+ printf ("%sre_compile_pattern \"%s\" failed: %s\n", fail, test->pattern,
+ err);
+ return 1;
+ }
+
+ res = re_search (&regbuf, test->string, strlen (test->string),
+ test->start, strlen (test->string) - test->start, NULL);
+ if (res != test->res)
+ {
+ printf ("%sre_search \"%s\" \"%s\" failed: %d (expected %d)\n",
+ fail, test->pattern, test->string, res, test->res);
+ regfree (&regbuf);
+ return 1;
+ }
+
+ if (test->res > 0 && test->start == 0)
+ {
+ res = re_search (&regbuf, test->string, strlen (test->string),
+ test->res, strlen (test->string) - test->res, NULL);
+ if (res != test->res)
+ {
+ printf ("%sre_search from expected \"%s\" \"%s\" failed: %d (expected %d)\n",
+ fail, test->pattern, test->string, res, test->res);
+ regfree (&regbuf);
+ return 1;
+ }
+ }
+
+ regfree (&regbuf);
+ return 0;
+}
+
+static char *
+replace (char *p, char c)
+{
+ switch (c)
+ {
+ /* A -> A" */
+ case 'A': *p++ = '\xc3'; *p++ = '\x84'; break;
+ /* B -> O" */
+ case 'B': *p++ = '\xc3'; *p++ = '\x96'; break;
+ /* C -> U" */
+ case 'C': *p++ = '\xc3'; *p++ = '\x9c'; break;
+ /* D -> a" */
+ case 'D': *p++ = '\xc3'; *p++ = '\xa4'; break;
+ /* ! -> MULTIPLICATION SIGN */
+ case '!': *p++ = '\xc3'; *p++ = '\x97'; break;
+ /* = -> EM DASH */
+ case '=': *p++ = '\xe2'; *p++ = '\x80'; *p++ = '\x94'; break;
+ /* ~ -> MUSICAL SYMBOL HALF NOTE */
+ case '~': *p++ = '\xf0'; *p++ = '\x9d'; *p++ = '\x85'; *p++ = '\x9e';
+ break;
+ }
+ return p;
+}
+
+int
+do_mb_tests (const struct test_s *test)
+{
+ int i, j;
+ struct test_s t;
+ const char *const chars = "ABCD!=~";
+ char repl[8], *p;
+ char pattern[strlen (test->pattern) * 4 + 1];
+ char string[strlen (test->string) * 4 + 1];
+ char fail[8 + sizeof ("UTF-8 ")];
+
+ t.pattern = pattern;
+ t.string = string;
+ strcpy (fail, "UTF-8 ");
+ for (i = 1; i < 128; ++i)
+ {
+ p = repl;
+ for (j = 0; j < 7; ++j)
+ if (i & (1 << j))
+ {
+ if (!strchr (test->pattern, chars[j])
+ && !strchr (test->string, chars[j]))
+ break;
+ *p++ = chars[j];
+ }
+ if (j < 7)
+ continue;
+ *p = '\0';
+
+ for (j = 0, p = pattern; test->pattern[j]; ++j)
+ if (strchr (repl, test->pattern[j]))
+ p = replace (p, test->pattern[j]);
+ else if (test->pattern[j] == '\\' && test->pattern[j + 1])
+ {
+ *p++ = test->pattern[j++];
+ *p++ = test->pattern[j];
+ }
+ else
+ *p++ = test->pattern[j];
+ *p = '\0';
+
+ t.start = test->start;
+ t.res = test->res;
+
+ for (j = 0, p = string; test->string[j]; ++j)
+ if (strchr (repl, test->string[j]))
+ {
+ char *d = replace (p, test->string[j]);
+ if (test->start > j)
+ t.start += d - p - 1;
+ if (test->res > j)
+ t.res += d - p - 1;
+ p = d;
+ }
+ else
+ *p++ = test->string[j];
+ *p = '\0';
+
+ p = stpcpy (fail + strlen ("UTF-8 "), repl);
+ *p++ = ' ';
+ *p = '\0';
+
+ if (do_one_test (&t, fail))
+ return 1;
+ }
+ return 0;
+}
+
+int
+main (void)
+{
size_t i;
int ret = 0;
mtrace ();
- setlocale (LC_ALL, "de_DE.UTF-8");
for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
{
- int res;
- re_set_syntax (tests[i].syntax);
- memset (&regbuf, '\0', sizeof (regbuf));
- err = re_compile_pattern (tests[i].pattern, strlen (tests[i].pattern),
- &regbuf);
- if (err != NULL)
+ if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL)
{
- printf ("re_compile_pattern failed: %s\n", err);
+ puts ("setlocale de_DE.ISO-8859-1 failed");
ret = 1;
- continue;
}
-
- res = re_search (&regbuf, tests[i].string, strlen (tests[i].string),
- tests[i].start,
- strlen (tests[i].string) - tests[i].start, NULL);
- if (res != tests[i].res)
+ ret |= do_one_test (&tests[i], "");
+ if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
{
- printf ("re_search %zd failed: %d\n", i, res);
+ puts ("setlocale de_DE.UTF-8 failed");
ret = 1;
- regfree (&regbuf);
- continue;
}
- regfree (&regbuf);
+ ret |= do_one_test (&tests[i], "UTF-8 ");
+ // Until the implementation is fixed, ignore the results of the
+ // MB tests.
+ /* ret |= */do_mb_tests (&tests[i]);
}
return ret;
diff --git a/posix/ptestcases.h b/posix/ptestcases.h
index 39e3494313..1a15f75f82 100644
--- a/posix/ptestcases.h
+++ b/posix/ptestcases.h
@@ -265,7 +265,7 @@
{ 1, 63, "a\\{1,63\\}", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", },
{ 0, 0, "2.8.3.4 BRE Precedence", NULL, },
{ 0, 0, "GA143", NULL, },
- { 2, 20, "\\^\\[[[.].]]\\\\(\\\\1\\\\)\\\\*\\\\{1,2\\\\}\\$", "a^[]\\(1\\)\\*\\{1,2\\}$b", },
+ { 2, 20, "\\^\\[[[.].]]\\\\(\\\\1\\\\)\\*\\\\{1,2\\\\}\\$", "a^[]\\(1\\)*\\{1,2\\}$b", },
{ 1, 6, "[[=*=]][[=\\=]][[=]=]][[===]][[...]][[:punct:]]", "*\\]=.;", },
{ 1, 6, "[$\\(*\\)^]*", "$\\()*^", },
{ 1, 1, "[\\1]", "1", },
diff --git a/posix/tst-rxspencer.c b/posix/tst-rxspencer.c
index 1b4b56f333..e9a61ea375 100644
--- a/posix/tst-rxspencer.c
+++ b/posix/tst-rxspencer.c
@@ -357,22 +357,34 @@ mb_tests (const char *pattern, int cflags, const char *string, int eflags,
for (i = 1; i < 16; ++i)
{
char *p = letters;
- if ((i & 1)
- && (strchr (pattern, 'a') || strchr (string, 'a')
- || strchr (pattern, 'A') || strchr (string, 'A')))
- *p++ = 'a', *p++ = 'A';
- if ((i & 2)
- && (strchr (pattern, 'b') || strchr (string, 'b')
- || strchr (pattern, 'B') || strchr (string, 'B')))
- *p++ = 'b', *p++ = 'B';
- if ((i & 4)
- && (strchr (pattern, 'c') || strchr (string, 'c')
- || strchr (pattern, 'C') || strchr (string, 'C')))
- *p++ = 'c', *p++ = 'C';
- if ((i & 8)
- && (strchr (pattern, 'd') || strchr (string, 'd')
- || strchr (pattern, 'D') || strchr (string, 'D')))
- *p++ = 'd', *p++ = 'D';
+ if (i & 1)
+ {
+ if (!strchr (pattern, 'a') && !strchr (string, 'a')
+ && !strchr (pattern, 'A') && !strchr (string, 'A'))
+ continue;
+ *p++ = 'a', *p++ = 'A';
+ }
+ if (i & 2)
+ {
+ if (!strchr (pattern, 'b') && !strchr (string, 'b')
+ && !strchr (pattern, 'B') && !strchr (string, 'B'))
+ continue;
+ *p++ = 'b', *p++ = 'B';
+ }
+ if (i & 4)
+ {
+ if (!strchr (pattern, 'c') && !strchr (string, 'c')
+ && !strchr (pattern, 'C') && !strchr (string, 'C'))
+ continue;
+ *p++ = 'c', *p++ = 'C';
+ }
+ if (i & 8)
+ {
+ if (!strchr (pattern, 'd') && !strchr (string, 'd')
+ && !strchr (pattern, 'D') && !strchr (string, 'D'))
+ continue;
+ *p++ = 'd', *p++ = 'D';
+ }
*p++ = '\0';
sprintf (fail, "UTF-8 %s FAIL", letters);
ret |= mb_test (pattern, cflags, string, eflags, expect, matches,