delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/01/12/09:13:00

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3C40445E.BFEEBC48@phekda.freeserve.co.uk>
Date: Sat, 12 Jan 2002 14:12:46 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: tests/libc/posix/regex/r1.c corrupted?
References: <3C36E32A DOT 202C3AF2 AT phekda DOT freeserve DOT co DOT uk> <2927-Sat05Jan2002144842+0200-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019