xref: /dflybsd-src/tools/regression/lib/libc-regex/README (revision abce74f49c2c19b069958a0b48de0a9987d14e35)
1*abce74f4SJohn MarinoNAME
2*abce74f4SJohn Marino  testregex - regex(3) test harness
3*abce74f4SJohn Marino
4*abce74f4SJohn MarinoSYNOPSIS
5*abce74f4SJohn Marino  testregex [ options ]
6*abce74f4SJohn Marino
7*abce74f4SJohn MarinoDESCRIPTION
8*abce74f4SJohn Marino  testregex reads regex(3) test specifications, one per line, from the
9*abce74f4SJohn Marino  standard input and writes one output line for each failed test. A
10*abce74f4SJohn Marino  summary line is written after all tests are done. Each successful
11*abce74f4SJohn Marino  test is run again with REG_NOSUB. Unsupported features are noted
12*abce74f4SJohn Marino  before the first test, and tests requiring these features are
13*abce74f4SJohn Marino  silently ignored.
14*abce74f4SJohn Marino
15*abce74f4SJohn MarinoOPTIONS
16*abce74f4SJohn Marino  -c	catch signals and non-terminating calls
17*abce74f4SJohn Marino  -e	ignore error return mismatches
18*abce74f4SJohn Marino  -h	list help on standard error
19*abce74f4SJohn Marino  -n	do not repeat successful tests with regnexec()
20*abce74f4SJohn Marino  -o	ignore match[] overrun errors
21*abce74f4SJohn Marino  -p	ignore negative position mismatches
22*abce74f4SJohn Marino  -s	use stack instead of malloc
23*abce74f4SJohn Marino  -x	do not repeat successful tests with REG_NOSUB
24*abce74f4SJohn Marino  -v	list each test line
25*abce74f4SJohn Marino  -A	list failed test lines with actual answers
26*abce74f4SJohn Marino  -B	list all test lines with actual answers
27*abce74f4SJohn Marino  -F	list failed test lines
28*abce74f4SJohn Marino  -P	list passed test lines
29*abce74f4SJohn Marino  -S	output one summary line
30*abce74f4SJohn Marino
31*abce74f4SJohn MarinoINPUT FORMAT
32*abce74f4SJohn Marino  Input lines may be blank, a comment beginning with #, or a test
33*abce74f4SJohn Marino  specification. A specification is five fields separated by one
34*abce74f4SJohn Marino  or more tabs. NULL denotes the empty string and NIL denotes the
35*abce74f4SJohn Marino  0 pointer.
36*abce74f4SJohn Marino
37*abce74f4SJohn Marino  Field 1: the regex(3) flags to apply, one character per REG_feature
38*abce74f4SJohn Marino  flag. The test is skipped if REG_feature is not supported by the
39*abce74f4SJohn Marino  implementation. If the first character is not [BEASKLP] then the
40*abce74f4SJohn Marino  specification is a global control line. One or more of [BEASKLP] may be
41*abce74f4SJohn Marino  specified; the test will be repeated for each mode.
42*abce74f4SJohn Marino
43*abce74f4SJohn Marino    B 	basic			BRE	(grep, ed, sed)
44*abce74f4SJohn Marino    E 	REG_EXTENDED		ERE	(egrep)
45*abce74f4SJohn Marino    A	REG_AUGMENTED		ARE	(egrep with negation)
46*abce74f4SJohn Marino    S	REG_SHELL		SRE	(sh glob)
47*abce74f4SJohn Marino    K	REG_SHELL|REG_AUGMENTED	KRE	(ksh glob)
48*abce74f4SJohn Marino    L	REG_LITERAL		LRE	(fgrep)
49*abce74f4SJohn Marino
50*abce74f4SJohn Marino    a	REG_LEFT|REG_RIGHT	implicit ^...$
51*abce74f4SJohn Marino    b	REG_NOTBOL		lhs does not match ^
52*abce74f4SJohn Marino    c	REG_COMMENT		ignore space and #...\n
53*abce74f4SJohn Marino    d	REG_SHELL_DOT		explicit leading . match
54*abce74f4SJohn Marino    e	REG_NOTEOL		rhs does not match $
55*abce74f4SJohn Marino    f	REG_MULTIPLE		multiple \n separated patterns
56*abce74f4SJohn Marino    g	FNM_LEADING_DIR		testfnmatch only -- match until /
57*abce74f4SJohn Marino    h	REG_MULTIREF		multiple digit backref
58*abce74f4SJohn Marino    i	REG_ICASE		ignore case
59*abce74f4SJohn Marino    j	REG_SPAN		. matches \n
60*abce74f4SJohn Marino    k	REG_ESCAPE		\ to ecape [...] delimiter
61*abce74f4SJohn Marino    l	REG_LEFT		implicit ^...
62*abce74f4SJohn Marino    m	REG_MINIMAL		minimal match
63*abce74f4SJohn Marino    n	REG_NEWLINE		explicit \n match
64*abce74f4SJohn Marino    o	REG_ENCLOSED		(|&) magic inside [@|&](...)
65*abce74f4SJohn Marino    p	REG_SHELL_PATH		explicit / match
66*abce74f4SJohn Marino    q	REG_DELIMITED		delimited pattern
67*abce74f4SJohn Marino    r	REG_RIGHT		implicit ...$
68*abce74f4SJohn Marino    s	REG_SHELL_ESCAPED	\ not special
69*abce74f4SJohn Marino    t	REG_MUSTDELIM		all delimiters must be specified
70*abce74f4SJohn Marino    u	standard unspecified behavior -- errors not counted
71*abce74f4SJohn Marino    v	REG_CLASS_ESCAPE	\ special inside [...]
72*abce74f4SJohn Marino    w	REG_NOSUB		no subexpression match array
73*abce74f4SJohn Marino    x	REG_LENIENT		let some errors slide
74*abce74f4SJohn Marino    y	REG_LEFT		regexec() implicit ^...
75*abce74f4SJohn Marino    z	REG_NULL		NULL subexpressions ok
76*abce74f4SJohn Marino    $	                        expand C \c escapes in fields 2 and 3
77*abce74f4SJohn Marino    /	                        field 2 is a regsubcomp() expression
78*abce74f4SJohn Marino    =	                        field 3 is a regdecomp() expression
79*abce74f4SJohn Marino
80*abce74f4SJohn Marino  Field 1 control lines:
81*abce74f4SJohn Marino
82*abce74f4SJohn Marino    C		set LC_COLLATE and LC_CTYPE to locale in field 2
83*abce74f4SJohn Marino
84*abce74f4SJohn Marino    ?test ...	output field 5 if passed and != EXPECTED, silent otherwise
85*abce74f4SJohn Marino    &test ...	output field 5 if current and previous passed
86*abce74f4SJohn Marino    |test ...	output field 5 if current passed and previous failed
87*abce74f4SJohn Marino    ; ...	output field 2 if previous failed
88*abce74f4SJohn Marino    {test ...	skip if failed until }
89*abce74f4SJohn Marino    }		end of skip
90*abce74f4SJohn Marino
91*abce74f4SJohn Marino    : comment		comment copied as output NOTE
92*abce74f4SJohn Marino    :comment:test	:comment: ignored
93*abce74f4SJohn Marino    N[OTE] comment	comment copied as output NOTE
94*abce74f4SJohn Marino    T[EST] comment	comment
95*abce74f4SJohn Marino
96*abce74f4SJohn Marino    number		use number for nmatch (20 by default)
97*abce74f4SJohn Marino
98*abce74f4SJohn Marino  Field 2: the regular expression pattern; SAME uses the pattern from
99*abce74f4SJohn Marino    the previous specification.
100*abce74f4SJohn Marino
101*abce74f4SJohn Marino  Field 3: the string to match.
102*abce74f4SJohn Marino
103*abce74f4SJohn Marino  Field 4: the test outcome. This is either one of the posix error
104*abce74f4SJohn Marino    codes (with REG_ omitted) or the match array, a list of (m,n)
105*abce74f4SJohn Marino    entries with m and n being first and last+1 positions in the
106*abce74f4SJohn Marino    field 3 string, or NULL if REG_NOSUB is in effect and success
107*abce74f4SJohn Marino    is expected. BADPAT is acceptable in place of any regcomp(3)
108*abce74f4SJohn Marino    error code. The match[] array is initialized to (-2,-2) before
109*abce74f4SJohn Marino    each test. All array elements from 0 to nmatch-1 must be specified
110*abce74f4SJohn Marino    in the outcome. Unspecified endpoints (offset -1) are denoted by ?.
111*abce74f4SJohn Marino    Unset endpoints (offset -2) are denoted by X. {x}(o:n) denotes a
112*abce74f4SJohn Marino    matched (?{...}) expression, where x is the text enclosed by {...},
113*abce74f4SJohn Marino    o is the expression ordinal counting from 1, and n is the length of
114*abce74f4SJohn Marino    the unmatched portion of the subject string. If x starts with a
115*abce74f4SJohn Marino    number then that is the return value of re_execf(), otherwise 0 is
116*abce74f4SJohn Marino    returned.
117*abce74f4SJohn Marino
118*abce74f4SJohn Marino  Field 5: optional comment appended to the report.
119*abce74f4SJohn Marino
120*abce74f4SJohn MarinoCAVEAT
121*abce74f4SJohn Marino    If a regex implementation misbehaves with memory then all bets are off.
122*abce74f4SJohn Marino
123*abce74f4SJohn MarinoCONTRIBUTORS
124*abce74f4SJohn Marino  Glenn Fowler    glenn.s.fowler@gmail.com    (ksh strmatch, regex extensions)
125*abce74f4SJohn Marino  David Korn      dgkorn@gmail.com            (ksh glob matcher)
126*abce74f4SJohn Marino  Doug McIlroy    mcilroy@dartmouth.edu       (ast regex/testre in C++)
127*abce74f4SJohn Marino  Tom Lord        lord@regexps.com            (rx tests)
128*abce74f4SJohn Marino  Henry Spencer   henry@zoo.toronto.edu       (original public regex)
129*abce74f4SJohn Marino  Andrew Hume     andrew@research.att.com     (gre tests)
130*abce74f4SJohn Marino  John Maddock    John_Maddock@compuserve.com (regex++ tests)
131*abce74f4SJohn Marino  Philip Hazel    ph10@cam.ac.uk              (pcre tests)
132*abce74f4SJohn Marino  Ville Laurikari vl@iki.fi                   (libtre tests)
133*abce74f4SJohn Marino
134*abce74f4SJohn MarinoWEB SITE
135*abce74f4SJohn Marino  http://www2.research.att.com/~astopen/testregex/
136*abce74f4SJohn Marino  AT&T Research regex(3) regression tests
137*abce74f4SJohn Marino
138*abce74f4SJohn Marino  Glenn Fowler <glenn.s.fowler@gmail.com>
139*abce74f4SJohn Marino  AT&T Research - Florham Park NJ
140*abce74f4SJohn Marino
141*abce74f4SJohn Marino  testregex.c 2004-05-31 is the latest source for the AT&T Research regression
142*abce74f4SJohn Marino  test harness for the X/Open regex pattern match interface.
143*abce74f4SJohn Marino  The source and test data posted here are license free.
144*abce74f4SJohn Marino
145*abce74f4SJohn Marino  testregex can:
146*abce74f4SJohn Marino     - verify stability for a particular implementation in the face of source
147*abce74f4SJohn Marino       code and/or compilation environment changes
148*abce74f4SJohn Marino     - verify standard compliance for all implementations
149*abce74f4SJohn Marino     - provide a basis for discussions on what compliance means
150