diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.gitignore | 8 | ||||
-rw-r--r-- | tests/Makefile.am | 84 | ||||
-rw-r--r-- | tests/atlocal.in | 10 | ||||
-rw-r--r-- | tests/cfhelp.at | 76 | ||||
-rw-r--r-- | tests/format00.at | 38 | ||||
-rw-r--r-- | tests/format01.at | 38 | ||||
-rw-r--r-- | tests/format02.at | 38 | ||||
-rw-r--r-- | tests/gcf1.conf | 54 | ||||
-rw-r--r-- | tests/gcffmt.c | 67 | ||||
-rw-r--r-- | tests/gcfpeek.c | 76 | ||||
-rw-r--r-- | tests/gcfset.c | 240 | ||||
-rw-r--r-- | tests/peek00.at | 25 | ||||
-rw-r--r-- | tests/peek01.at | 30 | ||||
-rw-r--r-- | tests/peek02.at | 26 | ||||
-rw-r--r-- | tests/peek03.at | 33 | ||||
-rw-r--r-- | tests/set.at | 38 | ||||
-rw-r--r-- | tests/testsuite.at | 54 |
17 files changed, 935 insertions, 0 deletions
diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..3110c40 --- /dev/null +++ b/tests/.gitignore | |||
@@ -0,0 +1,8 @@ | |||
1 | atconfig | ||
2 | atlocal | ||
3 | gcffmt | ||
4 | gcfpeek | ||
5 | gcfset | ||
6 | package.m4 | ||
7 | testsuite | ||
8 | testsuite.log | ||
diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..4312f99 --- /dev/null +++ b/tests/Makefile.am | |||
@@ -0,0 +1,84 @@ | |||
1 | # This file is part of grecs - Gray's Extensible Configuration System | ||
2 | # Copyright (C) 2007, 2009-2011 Sergey Poznyakoff | ||
3 | # | ||
4 | # Grecs is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 3, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # Grecs is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
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/>. | ||
16 | |||
17 | EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 gcf1.conf | ||
18 | DISTCLEANFILES = atconfig $(check_SCRIPTS) | ||
19 | MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) | ||
20 | |||
21 | |||
22 | ## ------------ ## | ||
23 | ## package.m4. ## | ||
24 | ## ------------ ## | ||
25 | |||
26 | $(srcdir)/package.m4: $(top_srcdir)/configure.ac | ||
27 | $(AM_V_GEN){ \ | ||
28 | echo '# Signature of the current package.'; \ | ||
29 | echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ | ||
30 | echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ | ||
31 | echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ | ||
32 | echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ | ||
33 | echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ | ||
34 | } >$(srcdir)/package.m4 | ||
35 | |||
36 | # | ||
37 | |||
38 | ## ------------ ## | ||
39 | ## Test suite. ## | ||
40 | ## ------------ ## | ||
41 | |||
42 | TESTSUITE_AT = \ | ||
43 | format00.at\ | ||
44 | format01.at\ | ||
45 | format02.at\ | ||
46 | cfhelp.at\ | ||
47 | peek00.at\ | ||
48 | peek01.at\ | ||
49 | peek02.at\ | ||
50 | peek03.at\ | ||
51 | set.at\ | ||
52 | testsuite.at | ||
53 | |||
54 | TESTSUITE = $(srcdir)/testsuite | ||
55 | M4=m4 | ||
56 | |||
57 | AUTOTEST = $(AUTOM4TE) --language=autotest | ||
58 | $(TESTSUITE): package.m4 $(TESTSUITE_AT) | ||
59 | $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp | ||
60 | mv $@.tmp $@ | ||
61 | |||
62 | atconfig: $(top_builddir)/config.status | ||
63 | cd $(top_builddir) && ./config.status tests/$@ | ||
64 | |||
65 | clean-local: | ||
66 | test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean | ||
67 | |||
68 | check-local: atconfig atlocal $(TESTSUITE) | ||
69 | $(SHELL) $(TESTSUITE) | ||
70 | |||
71 | # Run the test suite on the *installed* tree. | ||
72 | #installcheck-local: | ||
73 | # $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin | ||
74 | |||
75 | noinst_PROGRAMS = \ | ||
76 | gcffmt\ | ||
77 | gcfpeek\ | ||
78 | gcfset | ||
79 | |||
80 | LDADD=../src/libgrecs.a | ||
81 | INCLUDES = -I$(top_srcdir)/@GRECS_SUBDIR@/src | ||
82 | |||
83 | |||
84 | |||
diff --git a/tests/atlocal.in b/tests/atlocal.in new file mode 100644 index 0000000..553dae3 --- /dev/null +++ b/tests/atlocal.in | |||
@@ -0,0 +1,10 @@ | |||
1 | # @configure_input@ -*- shell-script -*- | ||
2 | # Configurable variable values for Grecs test suite. | ||
3 | # Copyright (C) 2011 Sergey Poznyakoff | ||
4 | |||
5 | PATH=@abs_builddir@:$PATH | ||
6 | |||
7 | XFAILFILE=$abs_builddir/.badversion | ||
8 | |||
9 | trap "cleanup; test -r $XFAILFILE && cat $XFAILFILE; exit $?" 1 2 13 15 | ||
10 | |||
diff --git a/tests/cfhelp.at b/tests/cfhelp.at new file mode 100644 index 0000000..cab6624 --- /dev/null +++ b/tests/cfhelp.at | |||
@@ -0,0 +1,76 @@ | |||
1 | # This file is part of grecs -*- Autotest -*- | ||
2 | # Copyright (C) 2007, 2009-2011 Sergey Poznyakoff | ||
3 | # | ||
4 | # Grecs is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 3, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # Grecs is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
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/>. | ||
16 | |||
17 | AT_SETUP(Help) | ||
18 | AT_KEYWORDS([help]) | ||
19 | |||
20 | AT_CHECK([gcfset -cfhelp], | ||
21 | [0], | ||
22 | [# Sample configuration file structure. | ||
23 | |||
24 | # Scalar string | ||
25 | scalar <label: string>; | ||
26 | |||
27 | # Configure logging logging | ||
28 | logging { | ||
29 | # Send to syslog | ||
30 | syslog <arg: boolean>; | ||
31 | |||
32 | # Set logging facility | ||
33 | facility <name: string>; | ||
34 | |||
35 | # Tag logging messages with this string | ||
36 | tag <label: string>; | ||
37 | |||
38 | # Prefix each message with its priority | ||
39 | print-priority <arg: boolean>; | ||
40 | } | ||
41 | |||
42 | # Mailbox configuration | ||
43 | mailbox { | ||
44 | # Default mailbox pattern | ||
45 | mailbox-pattern <arg: string>; | ||
46 | |||
47 | # Default mailbox type | ||
48 | mailbox-type <arg: string>; | ||
49 | } | ||
50 | |||
51 | # Subprogram configuration | ||
52 | program <name: string> { | ||
53 | # Scalar string | ||
54 | scalar <label: string>; | ||
55 | |||
56 | # Configure logging logging | ||
57 | logging { | ||
58 | # Send to syslog | ||
59 | syslog <arg: boolean>; | ||
60 | |||
61 | # Set logging facility | ||
62 | facility <name: string>; | ||
63 | |||
64 | # Tag logging messages with this string | ||
65 | tag <label: string>; | ||
66 | |||
67 | # Prefix each message with its priority | ||
68 | print-priority <arg: boolean>; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | # list variable | ||
73 | listvar <arg: list of string>; | ||
74 | ]) | ||
75 | |||
76 | AT_CLEANUP | ||
diff --git a/tests/format00.at b/tests/format00.at new file mode 100644 index 0000000..e7ae15f --- /dev/null +++ b/tests/format00.at | |||
@@ -0,0 +1,38 @@ | |||
1 | # This file is part of grecs -*- Autotest -*- | ||
2 | # Copyright (C) 2007, 2009-2011 Sergey Poznyakoff | ||
3 | # | ||
4 | # Grecs is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 3, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # Grecs is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
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/>. | ||
16 | |||
17 | AT_SETUP(Format) | ||
18 | AT_KEYWORDS([format format00]) | ||
19 | |||
20 | AT_CHECK([gcffmt $abs_srcdir/gcf1.conf], | ||
21 | [0], | ||
22 | [.scalar: "yes" | ||
23 | .listvar: ("a", "2", "b", "c") | ||
24 | .compound: "stmt" "2" "foo" | ||
25 | .mailbox.mailbox-pattern: "maildir:/var/mail;type=index;param=2;user=${user}" | ||
26 | .mailbox.mailbox-type: "maildir" | ||
27 | .logging.syslog: "yes" | ||
28 | .logging.facility: "mail" | ||
29 | .program="foo".logging.syslog: "yes" | ||
30 | .program="foo".logging.facility: "local1" | ||
31 | .program="foo".scalar: "no" | ||
32 | .program="bar".logging.syslog: "no" | ||
33 | .program="bar".logging.facility: "local2" | ||
34 | .program="bar".logging.tag: "baz" | ||
35 | .program="bar".scalar: "25" | ||
36 | ]) | ||
37 | |||