aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore8
-rw-r--r--tests/Makefile.am84
-rw-r--r--tests/atlocal.in10
-rw-r--r--tests/cfhelp.at76
-rw-r--r--tests/format00.at38
-rw-r--r--tests/format01.at38
-rw-r--r--tests/format02.at38
-rw-r--r--tests/gcf1.conf54
-rw-r--r--tests/gcffmt.c67
-rw-r--r--tests/gcfpeek.c76
-rw-r--r--tests/gcfset.c240
-rw-r--r--tests/peek00.at25
-rw-r--r--tests/peek01.at30
-rw-r--r--tests/peek02.at26
-rw-r--r--tests/peek03.at33
-rw-r--r--tests/set.at38
-rw-r--r--tests/testsuite.at54
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 @@
1atconfig
2atlocal
3gcffmt
4gcfpeek
5gcfset
6package.m4
7testsuite
8testsuite.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
17EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 gcf1.conf
18DISTCLEANFILES = atconfig $(check_SCRIPTS)
19MAINTAINERCLEANFILES = 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
42TESTSUITE_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
54TESTSUITE = $(srcdir)/testsuite
55M4=m4
56
57AUTOTEST = $(AUTOM4TE) --language=autotest
58$(TESTSUITE): package.m4 $(TESTSUITE_AT)
59 $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
60 mv $@.tmp $@
61
62atconfig: $(top_builddir)/config.status
63 cd $(top_builddir) && ./config.status tests/$@
64
65clean-local:
66 test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
67
68check-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
75noinst_PROGRAMS = \
76 gcffmt\
77 gcfpeek\
78 gcfset
79
80LDADD=../src/libgrecs.a
81INCLUDES = -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
5PATH=@abs_builddir@:$PATH
6
7XFAILFILE=$abs_builddir/.badversion
8
9trap "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
17AT_SETUP(Help)
18AT_KEYWORDS([help])
19
20AT_CHECK([gcfset -cfhelp],
21[0],
22[# Sample configuration file structure.
23
24# Scalar string
25scalar <label: string>;
26
27# Configure logging logging
28logging {
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
43mailbox {
44 # Default mailbox pattern
45 mailbox-pattern <arg: string>;
46
47 # Default mailbox type
48 mailbox-type <arg: string>;
49}
50
51# Subprogram configuration
52program <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
73listvar <arg: list of string>;
74])
75
76AT_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
17AT_SETUP(Format)
18AT_KEYWORDS([format format00])
19
20AT_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