aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/git-parser.c15
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/gcffmt.c15
-rw-r--r--tests/git.conf13
-rw-r--r--tests/meta1.conf136
-rw-r--r--tests/parser-git.at32
-rw-r--r--tests/parser-meta1.at122
-rw-r--r--tests/testsuite.at3
8 files changed, 335 insertions, 5 deletions
diff --git a/src/git-parser.c b/src/git-parser.c
index e0675ef..117a8fc 100644
--- a/src/git-parser.c
+++ b/src/git-parser.c
@@ -47,7 +47,7 @@ struct token {
47#define ISINITIAL(c) ((isascii(c) && isalpha(c)) || (c) == '_') 47#define ISINITIAL(c) ((isascii(c) && isalpha(c)) || (c) == '_')
48 48
49static int 49static int
50input() 50rawinput()
51{ 51{
52 if (!infile || feof(infile)) 52 if (!infile || feof(infile))
53 return 0; 53 return 0;
@@ -57,6 +57,17 @@ input()
57 return input_char; 57 return input_char;
58} 58}
59 59
60static int
61input()
62{
63 rawinput();
64 if (input_char == '#') {
65 while (rawinput() && input_char != '\n')
66 ;
67 }
68 return input_char;
69}
70
60static void 71static void
61unput() 72unput()
62{ 73{
@@ -87,7 +98,7 @@ collect_tag()
87static void 98static void
88collect_string() 99collect_string()
89{ 100{
90 while (input()) { 101 while (rawinput()) {
91 if (input_char == '\\') { 102 if (input_char == '\\') {
92 if (!input()) { 103 if (!input()) {
93 grecs_error(&grecs_current_locus, 0, 104 grecs_error(&grecs_current_locus, 0,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 73ffeae..f5d1f6f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -14,7 +14,7 @@
14# You should have received a copy of the GNU General Public License 14# You should have received a copy of the GNU General Public License
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
17EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 gcf1.conf 17EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 gcf1.conf meta1.conf git.conf
18DISTCLEANFILES = atconfig $(check_SCRIPTS) 18DISTCLEANFILES = atconfig $(check_SCRIPTS)
19MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) 19MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
20 20
@@ -51,6 +51,8 @@ TESTSUITE_AT = \
51 glob03.at\ 51 glob03.at\
52 enum.at\ 52 enum.at\
53 join.at\ 53 join.at\
54 parser-git.at\
55 parser-meta1.at\
54 peek00.at\ 56 peek00.at\
55 peek01.at\ 57 peek01.at\
56 peek02.at\ 58 peek02.at\
diff --git a/tests/gcffmt.c b/tests/gcffmt.c
index b4a4ece..51e3037 100644
--- a/tests/gcffmt.c
+++ b/tests/gcffmt.c
@@ -26,7 +26,7 @@ usage(const char *arg, FILE *fp, int code)
26{ 26{
27 fprintf(fp, 27 fprintf(fp,
28 "usage: %s [-h] [-locus] [-delim=char] [-reduce] [-sort] " 28 "usage: %s [-h] [-locus] [-delim=char] [-reduce] [-sort] "
29 "file [file...]\n", 29 "[-type=grecs|bind|meta1|git] file [file...]\n",
30 arg); 30 arg);
31 exit(code); 31 exit(code);
32} 32}
@@ -59,7 +59,18 @@ main(int argc, char **argv)
59 sort = 1; 59 sort = 1;
60 else if (strcmp(arg, "-h") == 0) 60 else if (strcmp(arg, "-h") == 0)
61 usage(progname, stdout, 0); 61 usage(progname, stdout, 0);
62 else if (arg[0] == '-') 62 else if (strncmp(arg, "-type=", 6) == 0) {
63 if (strcasecmp(arg+6, "GRECS") == 0)
64 grecs_parser_fun = grecs_grecs_parser;
65 else if (strcasecmp(arg+6, "META1") == 0)
66 grecs_parser_fun = grecs_meta1_parser;
67 else if (strcasecmp(arg+6, "BIND") == 0)
68 grecs_parser_fun = grecs_bind_parser;
69 else if (strcasecmp(arg+6, "GIT") == 0)
70 grecs_parser_fun = grecs_git_parser;
71 else
72 usage(progname, stderr, 1);
73 } else if (arg[0] == '-')
63 usage(progname, stderr, 1); 74 usage(progname, stderr, 1);
64 else { 75 else {
65 file = arg; 76 file = arg;
diff --git a/tests/git.conf b/tests/git.conf
new file mode 100644
index 0000000..6e8b2b2
--- /dev/null
+++ b/tests/git.conf
@@ -0,0 +1,13 @@
1# Sample Git configuration file for Grecs
2#
3[core] # Comment
4 repositoryformatversion = 0
5 filemode = true
6 bare = false # Comment
7 logallrefupdates = true
8[remote "origin"]
9 fetch = +refs/heads/*:refs/remotes/origin/*
10 url = ssh://git.gnu.org.ua/gitroot/grecs.git
11[branch "master"]
12 remote = origin
13 merge = refs/heads/master
diff --git a/tests/meta1.conf b/tests/meta1.conf
new file mode 100644
index 0000000..22ac218
--- /dev/null
+++ b/tests/meta1.conf
@@ -0,0 +1,136 @@
1# Sample MeTA1 configuration file for Grecs testsuite.
2
3hostname = "host.example.org";
4
5smtps {
6 greeting = "220 example.org ESMTP Tossudament alcats\r\n";
7 log_level = 12;
8 log { facility=mail; ident="smtps"; }
9 flags = { 8bitmime,
10 access };
11 CDB_gid = 2262;
12 wait_for_server = 4;
13 listen_socket { type=inet; port = 25; }
14 start_action = pass;
15 pass_fd_socket = smtps/smtpsfd;
16 user = meta1s;
17 path = "/usr/local/libexec/smtps";
18 arguments = "smtps -f /etc/meta1/meta1.conf";
19 policy_milter {
20 socket {
21 type = inet;
22 address = 127.0.0.1;
23 port = 3333;
24 };
25 timeout = 1800s;
26 flags = { accept_but_reconnect };
27 };
28 io_timeout = 300s;
29 module_timeout = 1000s;
30 auth {
31 flags = { noanonymous };
32 }
33}
34
35smtps MSA {
36 log_level = 11;
37 log { facility=mail; ident="MSA"; }
38 CDB_gid = 2262;
39 listen_socket { type=inet; port = 587; }
40 start_action = pass;
41 pass_fd_socket = smtps/msafd;
42 user = meta1s;
43 path = "/usr/local/libexec/smtps";
44 arguments = "smtps -I 1 -N MSA -f /etc/meta1/meta1.conf";
45}
46
47smtpc {
48 log_level = 12;
49 log { facility=mail; ident="smtpc"; }
50 flags = { read_QUIT_reply,
51 separate_final_dot_and_QUIT,
52 talk_to_myself };
53 LMTP_socket="lmtpsock";
54 wait_for_server = 4;
55 start_action = wait;
56 user = meta1c;
57 path = "/usr/local/libexec/smtpc";
58 arguments = "smtpc -f /etc/meta1/meta1.conf";
59}
60
61# must be previous to last in the list: started after smar
62qmgr {
63 log_level = 12;
64 log { facility=mail; ident="qmgr"; }
65 wait_for_server = 4;
66 wait_for_client = 3;
67 start_action = wait;
68 user = meta1q;
69 restart_dependencies = { smtps, MSA, smtpc };
70 path = "/usr/local/libexec/qmgr";
71 arguments = "qmgr -f /etc/meta1/meta1.conf";
72 control_socket = "qmgr/sock";
73}
74
75
76# must be last in the list: started first
77smar {
78 DNS { nameservers={ 10.11.0.1, 10.12.0.1 };
79 flags = use_connect; }
80 log_level = 12;
81 log { facility=mail; ident="smar"; }
82 nameserver = 10.11.0.1;
83 start_action = wait;
84 user = meta1m;
85 restart_dependencies = { smtps, MSA, qmgr };
86 path = "/usr/local/libexec/smar";
87 arguments = "smar -f /etc/meta1/meta1.conf";
88
89 map mtdb {
90 type = hash;
91 file = "mt.db";
92 }
93 mailertable {
94 name = mtdb;
95 flags = { full_address, domain };
96 }
97
98 map password { type = passwd; }
99 map userdb {
100 type = socket;
101 path = "/var/spool/meta1/smap/userdb";
102 mapname = userdb;
103 min_connections = 10;
104 max_connections = 1024;
105 timeout = 5;
106 }
107 map locusr {
108 type = sequence;
109 maps = { password, userdb };
110 }
111
112 local_user_map {
113 name = "locusr";
114 flags = { localpart, local_domains };
115 }
116
117 map lum {
118 type = socket;
119 path = "/var/spool/meta1/smap/userdb";
120 mapname = alias;
121 min_connections = 10;