summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/fnmatch
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/regress/lib/libc/fnmatch/Makefile10
-rw-r--r--src/regress/lib/libc/fnmatch/fnm_test.c62
-rw-r--r--src/regress/lib/libc/fnmatch/fnm_test.in260
3 files changed, 0 insertions, 332 deletions
diff --git a/src/regress/lib/libc/fnmatch/Makefile b/src/regress/lib/libc/fnmatch/Makefile
deleted file mode 100644
index 4acdd351bc..0000000000
--- a/src/regress/lib/libc/fnmatch/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1# $OpenBSD: Makefile,v 1.2 2011/09/17 15:12:38 stsp Exp $
2
3PROG= fnm_test
4LDADD+= -lutil
5DPADD+= ${LIBUTIL}
6
7run-regress-${PROG}:
8 ./${PROG} ${.CURDIR}/${PROG}.in
9
10.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/fnmatch/fnm_test.c b/src/regress/lib/libc/fnmatch/fnm_test.c
deleted file mode 100644
index ee04f6335e..0000000000
--- a/src/regress/lib/libc/fnmatch/fnm_test.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/* $OpenBSD: fnm_test.c,v 1.3 2019/01/25 00:19:26 millert Exp $ */
2
3/*
4 * Public domain, 2008, Todd C. Miller <millert@openbsd.org>
5 */
6
7#include <err.h>
8#include <fnmatch.h>
9#include <stdio.h>
10#include <stdlib.h>
11#include <util.h>
12
13int
14main(int argc, char **argv)
15{
16 FILE *fp = stdin;
17 char pattern[1024], string[1024];
18 char *line;
19 const char delim[3] = {'\0', '\0', '#'};
20 int errors = 0, flags, got, want;
21
22 if (argc > 1) {
23 if ((fp = fopen(argv[1], "r")) == NULL)
24 err(1, "%s", argv[1]);
25 }
26
27 /*
28 * Read in test file, which is formatted thusly:
29 *
30 * pattern string flags expected_result
31 *
32 * lines starting with '#' are comments
33 */
34 for (;;) {
35 line = fparseln(fp, NULL, NULL, delim, 0);
36 if (!line)
37 break;
38 got = sscanf(line, "%s %s 0x%x %d", pattern, string, &flags,
39 &want);
40 if (got == EOF) {
41 free(line);
42 break;
43 }
44 if (pattern[0] == '#') {
45 free(line);
46 continue;
47 }
48 if (got == 4) {
49 got = fnmatch(pattern, string, flags);
50 if (got != want) {
51 warnx("%s %s %d: want %d, got %d", pattern,
52 string, flags, want, got);
53 errors++;
54 }
55 } else {
56 warnx("unrecognized line '%s'\n", line);
57 errors++;
58 }
59 free(line);
60 }
61 exit(errors);
62}
diff --git a/src/regress/lib/libc/fnmatch/fnm_test.in b/src/regress/lib/libc/fnmatch/fnm_test.in
deleted file mode 100644
index c2f218ae1b..0000000000
--- a/src/regress/lib/libc/fnmatch/fnm_test.in
+++ /dev/null
@@ -1,260 +0,0 @@
1/bin/[[:alpha:][:alnum:]]* /bin/ls 0x2 0
2/bin/[[:upper:]][[:alnum:]] /bin/ls 0x10 0
3/bin/[[:opper:][:alnum:]]* /bin/ls 0x0 1
4[[:alpha:][:alnum:]]*.c foo1.c 0x4 0
5[[:upper:]]* FOO 0x0 0
6[![:space:]]* bar 0x0 0
7# 'te\st' 'test'; no match if FNM_NOESCAPE
8te\st test 0x0 0
9te\st test 0x1 1
10te\st test 0x1e 0
11# 'te\\st' 'te\st'; no match if FNM_NOESCAPE
12te\\st te\st 0x0 0
13te\\st te\st 0x1 1
14te\\st te\st 0x1e 0
15# 'te\*t' 'te*t'; no match if FNM_NOESCAPE
16te\*t te*t 0x0 0
17te\*t te*t 0x1 1
18te\*t te*t 0x1e 0
19# 'te\*t' 'test'; no match
20te\*t test 0x0 1
21te\*t test 0x1f 1
22# 'te\?t' 'te?t'; no match if FNM_NOESCAPE
23te\?t te?t 0x0 0
24te\?t te?t 0x1 1
25te\?t te?t 0x1e 0
26# 'te\?t' 'test'; no match
27te\?t test 0x0 1
28te\?t test 0x1f 1
29# 'tesT' 'test'; match if FNM_CASEFOLD
30tesT test 0x0 1
31tesT test 0xf 1
32tesT test 0x10 0
33# 'test' 'Test'; match if FNM_CASEFOLD
34test Test 0x0 1
35test Test 0xf 1
36test Test 0x10 0
37# 'tEst' 'teSt'; match if FNM_CASEFOLD
38tEst teSt 0x0 1
39tEst teSt 0xf 1
40tEst teSt 0x10 0
41# '?est' 'test'; match always
42?est test 0x0 0
43?est test 0x1f 0
44# 'te?t' 'test'; match always
45te?t test 0x0 0
46te?t test 0x1f 0
47# 'tes?' 'test'; match always
48tes? test 0x0 0
49tes? test 0x1f 0
50# 'test?' 'test'; no match
51test? test 0x0 1
52test? test 0x1f 1
53# '*' always matches anything
54* test 0x0 0
55* test 0x1f 0
56# '*test' 'test'; match always
57*test test 0x0 0
58*test test 0x1f 0
59# '*est' 'test'; match always
60*est test 0x0 0
61*est test 0x1f 0
62# '*st' 'test'; match always
63*st test 0x0 0
64*st test 0x1f 0
65# 't*t' 'test'; match always
66t*t test 0x0 0
67t*t test 0x1f 0
68# 'te*t' 'test'; match always
69te*t test 0x0 0
70te*t test 0x1f 0
71# 'te*st' 'test'; match always
72te*st test 0x0 0
73te*st test 0x1f 0
74# 'te*' 'test'; match always
75te* test 0x0 0
76te* test 0x1f 0
77# 'tes*' 'test'; match always
78tes* test 0x0 0
79tes* test 0x1f 0
80# 'test*' 'test'; match always
81test* test 0x0 0
82test* test 0x1f 0
83# '.[\-\t]' '.t'; match always
84.[\-\t] .t 0x0 0
85.[\-\t] .t 0x1f 0
86# 'test*?*[a-z]*' 'testgoop'; match always
87test*?*[a-z]* testgoop 0x0 0
88test*?*[a-z]* testgoop 0x1f 0
89# 'te[^abc]t' 'test'; match always
90te[^abc]t test 0x0 0
91te[^abc]t test 0x1f 0
92# 'te[^x]t' 'test'; match always
93te[^x]t test 0x0 0
94te[^x]t test 0x1f 0
95# 'te[!x]t' 'test'; match always
96te[!x]t test 0x0 0
97te[^x]t test 0x1f 0
98# 'te[^x]t' 'text'; no match
99te[^x]t text 0x0 1
100te[^x]t text 0x1f 1
101# 'te[^\x]t' 'text'; no match
102te[^\x]t text 0x0 1
103te[^\x]t text 0x1f 1
104# 'te[^\x' 'text'; no match
105te[^\x text 0x0 1
106te[^\x text 0x1f 1
107# 'te[/]t' 'text'; no match
108te[/]t text 0x0 1
109te[/]t text 0x1f 1
110# 'te[S]t' 'test'; match if FNM_CASEFOLD
111te[S]t test 0x0 1
112te[S]t test 0xf 1
113te[S]t test 0x10 0
114# 'te[r-t]t' 'test'; match always
115te[r-t]t test 0x0 0
116te[r-t]t test 0x1f 0
117# 'te[r-t]t' 'teSt'; match if FNM_CASEFOLD
118te[r-t]t teSt 0x0 1
119te[r-t]t teSt 0xf 1
120te[r-t]t teSt 0x10 0
121# 'te[r-T]t' 'test'; match if FNM_CASEFOLD
122te[r-T]t test 0x0 1
123te[r-T]t test 0xf 1
124te[r-T]t test 0x10 0
125# 'te[R-T]t' 'test'; match if FNM_CASEFOLD
126te[R-T]t test 0x0 1
127te[R-T]t test 0xf 1
128te[R-T]t test 0x10 0
129# 'te[r-Tz]t' 'tezt'; match always
130te[r-Tz]t tezt 0x0 0
131te[r-Tz]t tezt 0x1f 0
132# 'te[R-T]t' 'tent'; no match
133te[R-T]t tent 0x0 1
134te[R-T]t tent 0x1f 1
135# 'tes[]t]' 'test'; match always
136tes[]t] test 0x0 0
137tes[]t] test 0x1f 0
138# 'tes[t-]' 'test'; match always
139tes[t-] test 0x0 0
140tes[t-] test 0x1f 0
141# 'tes[t-]]' 'test]'; match always
142tes[t-]] test] 0x0 0
143tes[t-]] test] 0x1f 0
144# 'tes[t-]]' 'test'; no match
145tes[t-]] test 0x0 1
146tes[t-]] test 0x1f 1
147# 'tes[u-]' 'test'; no match
148tes[u-] test 0x0 1
149tes[u-] test 0x1f 1
150# 'tes[t-]' 'tes[t-]'; no match
151tes[t-] test[t-] 0x0 1
152tes[t-] test[t-] 0x1f 1
153# 'test[/-/]' 'test[/-/]'; no match
154test[/-/] test/-/ 0x0 1
155test[/-/] test/-/ 0x1f 1
156# 'test[\/-/]' 'test[/-/]'; no match
157test[\/-/] test/-/ 0x0 1
158test[\/-/] test/-/ 0x1f 1
159# 'test[/-\/]' 'test[/-/]'; no match
160test[/-\/] test/-/ 0x0 1
161test[/-\/] test/-/ 0x1f 1
162# 'test[/-/]' 'test/'; no match if APR_FNM_PATHNAME
163test[/-/] test/ 0x0 0
164test[/-/] test/ 0x2 1
165test[/-/] test/ 0x1d 0
166# 'test[\/-/]' 'test/'; no match if APR_FNM_PATHNAME
167test[\/-/] test/ 0x0 0
168test[\/-/] test/ 0x2 1
169test[\/-/] test/ 0x1d 0
170# 'test[/-\/]' 'test/'; no match if APR_FNM_PATHNAME
171test[/-\/] test/ 0x0 0
172test[/-\/] test/ 0x2 1
173test[/-\/] test/ 0x1d 0
174# '/test' 'test'; no match
175/test test 0x0 1
176/test test 0x1f 1
177# 'test' '/test'; no match
178test /test 0x0 1
179test /test 0x1f 1
180# 'test/' 'test'; no match
181test/ test 0x0 1
182test/ test 0x1f 1
183# 'test' 'test/'; match if FNM_LEADING_DIR
184test test/ 0x0 1
185test test/ 0x17 1
186test test/ 0x8 0
187# '\/test' '/test'; match unless FNM_NOESCAPE
188\/test /test 0x0 0
189\/test /test 0x1 1
190\/test /test 0x1e 0
191# '*test' '/test'; match unless FNM_PATHNAME
192*test /test 0x0 0
193*test /test 0x2 1
194*test /test 0x1d 0
195# '/*/test' '/test'; no match
196/*/test /test 0x0 1
197/*/test /test 0x1f 1
198# '/*/test' '/test/test'; match always
199/*/test /test/test 0x0 0
200/*/test /test/test 0x1f 0
201# 'test/this' 'test/'; match never
202test/this test/ 0x0 1
203test/this test/ 0x1f 1
204# 'test/' 'test/this'; match never
205test/ test/this 0x0 1
206test/ test/this 0x1f 1
207# 'test*/this' 'test/this'; match always
208test*/this test/this 0x0 0
209test*/this test/this 0x1f 0
210# 'test*/this' 'test/that'; match never
211test*/this test/that 0x0 1
212test*/this test/that 0x1f 1
213# 'test/*this' 'test/this'; match always
214test/*this test/this 0x0 0
215test/*this test/this 0x1f 0
216# '.*' '.this'; match always
217.* .this 0x0 0
218.* .this 0x1f 0
219# '*' '.this'; fails if FNM_PERIOD
220* .this 0x0 0
221* .this 0x4 1
222* .this 0x1b 0
223# '?this' '.this'; fails if FNM_PERIOD
224?this .this 0x0 0
225?this .this 0x4 1
226?this .this 0x1b 0
227# '[.]this' '.this'; fails if FNM_PERIOD
228[.]this .this 0x0 0
229[.]this .this 0x4 1
230[.]this .this 0x1b 0
231# 'test/this' 'test/this'; match always
232test/this test/this 0x0 0
233test/this test/this 0x1f 0
234# 'test?this' 'test/this'; fails if FNM_PATHNAME
235test?this test/this 0x0 0
236test?this test/this 0x2 1
237test?this test/this 0x1d 0
238# 'test*this' 'test/this'; fails if FNM_PATHNAME
239test*this test/this 0x0 0
240test*this test/this 0x2 1
241test*this test/this 0x1d 0
242# 'test[/]this' 'test/this'; fails if FNM_PATHNAME
243test[/]this test/this 0x0 0
244test[/]this test/this 0x2 1
245test[/]this test/this 0x1d 0
246# 'test/.*' 'test/.this'; match always
247test/.* test/.this 0x0 0
248test/.* test/.this 0x1f 0
249# 'test/*' 'test/.this'; fails if FNM_PERIOD and FNM_PATHNAME
250test/* test/.this 0x0 0
251test/* test/.this 0x6 1
252test/* test/.this 0x19 0
253# 'test/?' 'test/.this'; fails if FNM_PERIOD and FNM_PATHNAME
254test/?this test/.this 0x0 0
255test/?this test/.this 0x6 1
256test/?this test/.this 0x19 0
257# 'test/[.]this' 'test/.this'; fails if FNM_PERIOD and FNM_PATHNAME
258test/[.]this test/.this 0x0 0
259test/[.]this test/.this 0x6 1
260test/[.]this test/.this 0x19 0