diff options
-rw-r--r-- | README.submodule | 2 | ||||
-rw-r--r-- | src/bind-lex.l | 15 | ||||
-rw-r--r-- | src/grecs.h | 2 | ||||
-rw-r--r-- | src/preproc.c | 28 | ||||
-rw-r--r-- | tests/Makefile.am | 15 | ||||
-rw-r--r-- | tests/bind.conf | 126 | ||||
-rw-r--r-- | tests/bind.dlz | 33 | ||||
-rw-r--r-- | tests/bind.ext.conf | 25 | ||||
-rw-r--r-- | tests/bind.int.conf | 17 | ||||
-rw-r--r-- | tests/bind.keys | 11 | ||||
-rw-r--r-- | tests/gcffmt.c | 8 | ||||
-rw-r--r-- | tests/parser-bind.at | 95 | ||||
-rw-r--r-- | tests/testsuite.at | 1 |
13 files changed, 359 insertions, 19 deletions
diff --git a/README.submodule b/README.submodule index 03428d4..3067e92 100644 --- a/README.submodule +++ b/README.submodule | |||
@@ -33,5 +33,5 @@ recursively, joining several trees together, reductions, etc. | |||
33 | 1. Install grecs as a submodule: | 33 | 1. Install grecs as a submodule: |
34 | 34 | ||
35 | git submodule git.gnu.org.ua/gitroot/grecs.git grecs | 35 | git submodule git://git.gnu.org.ua/grecs.git grecs |
36 | 36 | ||
37 | 2. Add a call to GRECS_SETUP to your configure.ac. It can be as | 37 | 2. Add a call to GRECS_SETUP to your configure.ac. It can be as |
diff --git a/src/bind-lex.l b/src/bind-lex.l index 12dddf7..a5cf644 100644 --- a/src/bind-lex.l +++ b/src/bind-lex.l | |||
@@ -193,5 +193,18 @@ grecs_bind_new_source(const char *name) | |||
193 | &grecs_current_locus : NULL; | 193 | &grecs_current_locus : NULL; |
194 | struct stat st; | 194 | struct stat st; |
195 | FILE *fp = fopen(name, "r"); | 195 | FILE *fp; |
196 | |||
197 | if (access(name, F_OK)) { | ||
198 | int ec = errno; | ||
199 | char *tmp = grecs_find_include_file(name, 0); | ||
200 | if (!tmp) { | ||
201 | grecs_error(loc, ec, _("cannot open `%s'"), name); | ||
202 | return 1; | ||
203 | } | ||
204 | name = grecs_install_text(tmp); | ||
205 | free(tmp); | ||
206 | } | ||
207 | |||
208 | fp = fopen(name, "r"); | ||
196 | if (!fp) { | 209 | if (!fp) { |
197 | grecs_error(loc, errno, _("cannot open `%s'"), name); | 210 | grecs_error(loc, errno, _("cannot open `%s'"), name); |
diff --git a/src/grecs.h b/src/grecs.h index b839d71..5eef48d 100644 --- a/src/grecs.h +++ b/src/grecs.h | |||
@@ -264,4 +264,6 @@ void grecs_preproc_done(void); | |||
264 | int grecs_preproc_run(const char *config_file, const char *extpp); | 264 | int grecs_preproc_run(const char *config_file, const char *extpp); |
265 | 265 | ||
266 | char *grecs_find_include_file(const char *name, int allow_cwd); | ||
267 | |||
266 | FILE *grecs_preproc_extrn_start(const char *file, pid_t *ppid); | 268 | FILE *grecs_preproc_extrn_start(const char *file, pid_t *ppid); |
267 | void grecs_preproc_extrn_shutdown(pid_t pid); | 269 | void grecs_preproc_extrn_shutdown(pid_t pid); |
diff --git a/src/preproc.c b/src/preproc.c index 8debdcf..4ab3066 100644 --- a/src/preproc.c +++ b/src/preproc.c | |||
@@ -473,6 +473,6 @@ pop_source() | |||
473 | } | 473 | } |
474 | 474 | ||
475 | static int | 475 | char * |
476 | try_file(const char *name, int allow_cwd, int err_not_found, char **newp) | 476 | grecs_find_include_file(const char *name, int allow_cwd) |
477 | { | 477 | { |
478 | static char *cwd = "."; | 478 | static char *cwd = "."; |
@@ -496,14 +496,8 @@ try_file(const char *name, int allow_cwd, int err_not_found, char **newp) | |||
496 | if (!fd.found) { | 496 | if (!fd.found) { |
497 | pp_list_find(std_include_path, &fd); | 497 | pp_list_find(std_include_path, &fd); |
498 | 498 | if (!fd.found) | |
499 | if (!fd.found && err_not_found) { | 499 | return NULL; |
500 | grecs_error(&LOCUS, 0, | ||
501 | _("%s: No such file or directory"), name); | ||
502 | *newp = NULL; | ||
503 | } | ||
504 | } | 500 | } |
505 | if (fd.found) | 501 | return fd.buf; |
506 | *newp = fd.buf; | ||
507 | return fd.found; | ||
508 | } | 502 | } |
509 | 503 | ||
@@ -536,6 +530,11 @@ parse_include(const char *text, int once) | |||
536 | allow_cwd = 1; | 530 | allow_cwd = 1; |
537 | 531 | ||
538 | if (p[0] != '/' && try_file(p, allow_cwd, 1, &tmp)) | 532 | if (p[0] != '/') { |
539 | p = tmp; | 533 | p = grecs_find_include_file(p, allow_cwd); |
534 | if (!p) | ||
535 | grecs_error(&LOCUS, 0, | ||
536 | _("%s: No such file or directory"), | ||
537 | p); | ||
538 | } | ||
540 | } | 539 | } |
541 | 540 | ||
@@ -575,5 +574,6 @@ grecs_preproc_run(const char *config_file, const char *extpp) | |||
575 | char *cmd = NULL; | 574 | char *cmd = NULL; |
576 | 575 | ||
577 | if (try_file("pp-setup", 1, 0, &setup_file)) { | 576 | setup_file = grecs_find_include_file("pp-setup", 1); |
577 | if (setup_file) { | ||
578 | size_t size = 0; | 578 | size_t size = 0; |
579 | if (grecs_asprintf(&cmd, &size, | 579 | if (grecs_asprintf(&cmd, &size, |
diff --git a/tests/Makefile.am b/tests/Makefile.am index f5d1f6f..1b47712 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am | |||
@@ -15,5 +15,17 @@ | |||
15 | # along with Grecs. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with Grecs. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | ||
17 | EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 gcf1.conf meta1.conf git.conf | 17 | EXTRA_DIST = \ |
18 | $(TESTSUITE_AT)\ | ||
19 | testsuite\ | ||
20 | package.m4\ | ||
21 | gcf1.conf\ | ||
22 | bind.conf\ | ||
23 | bind.keys\ | ||
24 | bind.int.conf\ | ||
25 | bind.ext.conf\ | ||
26 | bind.dlz\ | ||
27 | meta1.conf\ | ||
28 | git.conf | ||
29 | |||
18 | DISTCLEANFILES = atconfig $(check_SCRIPTS) | 30 | DISTCLEANFILES = atconfig $(check_SCRIPTS) |
19 | MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) | 31 | MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) |
@@ -52,4 +64,5 @@ TESTSUITE_AT = \ | |||
52 | enum.at\ | 64 | enum.at\ |
53 | join.at\ | 65 | join.at\ |
66 | parser-bind.at\ | ||
54 | parser-git.at\ | 67 | parser-git.at\ |
55 | parser-meta1.at\ | 68 | parser-meta1.at\ |
diff --git a/tests/bind.conf b/tests/bind.conf new file mode 100644 index 0000000..2579a58 --- /dev/null +++ b/tests/bind.conf | |||
@@ -0,0 +1,126 @@ | |||
1 | # Sample Bind configuration file for Grecs testsuite. | ||
2 | # Nothing to copyright, really:) | ||
3 | |||
4 | acl upd-dyn-vpn { | ||
5 | key vpn.; | ||
6 | 10.11.0.1; | ||
7 | 10.10.0.1; | ||
8 | }; | ||
9 | |||
10 | acl foo-acl { | ||
11 | key foo.; | ||
12 | }; | ||
13 | |||
14 | options { | ||
15 | version "Grecs testsuite"; | ||
16 | coresize 0; | ||
17 | directory "/etc/namedb"; | ||
18 | pid-file "/var/log/bind/named.pid"; | ||
19 | allow-transfer { | ||
20 | foo-acl; | ||
21 | }; | ||
22 | allow-query { | ||
23 | any; | ||
24 | }; | ||
25 | serial-query-rate 5; | ||
26 | max-journal-size 5m; | ||
27 | check-names master warn; | ||
28 | check-names slave warn; | ||
29 | check-names response ignore; | ||
30 | }; | ||
31 | |||
32 | logging { | ||
33 | channel default_channel { | ||
34 | file "/var/log/bind/named.log" versions 9 size 524288; | ||
35 | print-time yes; | ||
36 | print-severity yes; | ||
37 | }; | ||
38 | channel debug_channel { | ||
39 | file "/var/log/bind/named.run" versions 9 size 524288; | ||
40 | print-time yes; | ||
41 | print-severity yes; | ||
42 | severity dynamic; | ||
43 | }; | ||
44 | channel security_channel { | ||
45 | file "/var/log/bind/security" versions 9 size 524288; | ||
46 | print-time yes; | ||
47 | print-severity yes; | ||
48 | }; | ||
49 | channel xfer_in_channel { | ||
50 | file "/var/log/bind/named-xfer.in" versions 9 size 524288; | ||
51 | print-time yes; | ||
52 | }; | ||
53 | channel xfer_out_channel { | ||
54 | file "/var/log/bind/named-xfer.out" versions 9 size 524288; | ||
55 | print-time yes; | ||
56 | }; | ||
57 | channel lamers_channel { | ||
58 | file "/var/log/bind/lamers.log" versions 5 size 524288; | ||
59 | print-time yes; | ||
60 | print-category yes; | ||
61 | }; | ||
62 | channel update_channel { | ||
63 | file "/var/log/bind/update.log" versions 9 size 524288; | ||
64 | print-time yes; | ||
65 | print-category yes; | ||
66 | severity debug 5; | ||
67 | }; | ||
68 | channel notify_channel { | ||
69 | file "/var/log/bind/notify.log" versions 9 size 524288; | ||
70 | print-time yes; | ||
71 | print-category yes; | ||
72 | }; | ||
73 | channel query_channel { | ||
74 | file "/var/log/bind/query.log" versions 9 size 524288; | ||
75 | print-time yes; | ||
76 | }; | ||
77 | category security { | ||
78 | security_channel; | ||
79 | }; | ||
80 | category queries { | ||
81 | # query_channel; | ||
82 | null; | ||
83 | }; | ||
84 | category default { | ||
85 | default_channel; | ||
86 | debug_channel; | ||
87 | }; | ||
88 | category xfer-in { | ||
89 | xfer_in_channel; | ||
90 | }; | ||
91 | category xfer-out { | ||
92 | xfer_out_channel; | ||
93 | }; | ||
94 | category delegation-only { | ||
95 | lamers_channel; | ||
96 | }; | ||
97 | category lame-servers { | ||
98 | lamers_channel; | ||
99 | }; |