Mail Archives: djgpp-workers/2002/01/12/09:13:00
Hello.
Eli Zaretskii wrote:
> Anyway, it's probably much better to write a new test that uses the
> file `tests' in src/libc/posix/regexp.
Well it looks like there already is. Looking at makefile.bsd in that
directory, I see that the files main.c, debug.c and split.c are used to
generate a program 're', which parses and checks the output of the regexps in
tests.
Below is a Makefile to use in src/libc/posix/regexp. Also below is a diff that
fixes some warnings in main.c and a test failure in tests. It appears the code
does report an error where the author of the code thought that it didn't. (NB:
This error occurs with or without the realloc() patch for regcomp.c.) Maybe
someone's fixed the code or the code and tests are from different versions of
the regexp library?
Now where should this test be built? It seems to make sense to me to keep it
where the sources are, since the test and the sources are from the same
package. So should I add a makefile.tst to src/libc/posix/regexp and put a
note in tests/libc/posix/regex saying where the test is? (Clearly we should
remove r1.c, since it serves no purpose.) If this is OK, I will post a new
patch.
Thanks, bye, Rich =]
---start makefile.tst---
CFLAGS += -g -Wall -I../../../../include
LDFLAGS += -g -Wall -I../../../../lib
OBJS = main.o debug.o split.o
default: check
# Check target copied from makefile.bsd
check: re tests
./re <tests
./re -el <tests
./re -er <tests
check-ignore: re tests
-./re <tests
-./re -el <tests
-./re -er <tests
re: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c $<
clean:
$(RM) -f $(OBJS) re re.exe
---end makefile.tst---
Index: main.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/regex/main.c,v
retrieving revision 1.2
diff -p -u -3 -r1.2 main.c
--- main.c 1998/07/16 18:20:30 1.2
+++ main.c 2002/01/12 14:03:44
@@ -1,9 +1,12 @@
+/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <regex.h>
#include <assert.h>
+#include <unistd.h>
#include "main.ih"
Index: tests
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/regex/tests,v
retrieving revision 1.1
diff -p -u -3 -r1.1 tests
--- tests 1998/07/16 18:20:30 1.1
+++ tests 2002/01/12 14:03:45
@@ -49,9 +49,10 @@ a\(b bC EPAREN
a(b C EPAREN
a(b b a(b a(b
# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
-a) - a) a)
-) - ) )
+a) C EPAREN a)
+) C EPAREN )
# end gagging (in a just world, those *should* give EPAREN)
+# (richdawe AT bigfoot DOT com): They seem to give EPAREN now!
a) b a) a)
a\) bC EPAREN
\) bC EPAREN
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -