aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-03-19 14:58:27 +0200
committerSergey Poznyakoff <gray@gnu.org>2016-03-19 16:30:41 +0200
commitd6102982ae0e69a2c75cd2a499ba3909516cc0ae (patch)
tree054f8a27dc1eb92497d9bb357f2cde7f0d823fac
parent60b43ae490f52a783a34c8d77baaa695f7c32f01 (diff)
downloadpies-d6102982ae0e69a2c75cd2a499ba3909516cc0ae.tar.gz
pies-d6102982ae0e69a2c75cd2a499ba3909516cc0ae.tar.bz2
Add testsute
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac5
-rw-r--r--doc/pies.texi2
-rw-r--r--src/progman.c2
-rw-r--r--tests/.gitignore6
-rw-r--r--tests/Makefile.am71
-rw-r--r--tests/atlocal.in6
-rw-r--r--tests/control.at55
-rwxr-xr-xtests/mailer7
-rw-r--r--tests/redirect.at60
-rwxr-xr-xtests/respawn63
-rw-r--r--tests/respawn.at52
-rw-r--r--tests/ret-exec.at68
-rw-r--r--tests/ret-notify.at68
-rwxr-xr-xtests/retcode9
-rw-r--r--tests/testsuite.at65
-rw-r--r--tests/version.at28
17 files changed, 566 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 0358e8c..ff6f5db 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,7 +16,7 @@
16 16
17ACLOCAL_AMFLAGS = -I m4 -I am -I grecs/am -I imprimatur 17ACLOCAL_AMFLAGS = -I m4 -I am -I grecs/am -I imprimatur
18 18
19SUBDIRS=gnu grecs lib ident src imprimatur doc po 19SUBDIRS=gnu grecs lib ident src tests imprimatur doc po
20 20
21dist-hook: 21dist-hook:
22 @PATCHLEV=`echo "$(PACKAGE_VERSION)" | \ 22 @PATCHLEV=`echo "$(PACKAGE_VERSION)" | \
diff --git a/configure.ac b/configure.ac
index 78702b4..6ee1084 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,6 +142,11 @@ AC_ARG_VAR([EMERGENCY_SHELL],[Filename of the emergency shell])
142 142
143IMPRIMATUR_INIT 143IMPRIMATUR_INIT
144 144
145# Initialize the test suite.
146AC_CONFIG_TESTDIR(tests)
147AC_CONFIG_FILES([tests/Makefile tests/atlocal])
148AM_MISSING_PROG([AUTOM4TE], [autom4te])
149
145AC_CONFIG_FILES([Makefile 150AC_CONFIG_FILES([Makefile
146 gnu/Makefile 151 gnu/Makefile
147 lib/Makefile 152 lib/Makefile
diff --git a/doc/pies.texi b/doc/pies.texi
index 15c37e1..0e8af70 100644
--- a/doc/pies.texi
+++ b/doc/pies.texi
@@ -1868,7 +1868,7 @@ The table below lists all available variables and their expansions:
1868@headitem Variable @tab Expansion 1868@headitem Variable @tab Expansion
1869@item canonical_program_name @tab @samp{pies} 1869@item canonical_program_name @tab @samp{pies}
1870@item program_name @tab Program name of the @command{pies} binary. 1870@item program_name @tab Program name of the @command{pies} binary.
1871@item package @tab Package name (@samp{Pies}). 1871@item package @tab Package name (@samp{GNU Pies}).
1872@item instance @tab Instance name (@pxref{instances}). 1872@item instance @tab Instance name (@pxref{instances}).
1873@item version @tab Package version (@value{VERSION}). 1873@item version @tab Package version (@value{VERSION}).
1874@item component @tab Name of the terminated component. 1874@item component @tab Name of the terminated component.
diff --git a/src/progman.c b/src/progman.c
index 5693011..fdb829a 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -2078,7 +2078,7 @@ notify (const char *tag, int status, struct action *act)
2078#define INSTANCE_IDX 3 2078#define INSTANCE_IDX 3
2079 "instance", NULL, 2079 "instance", NULL,
2080 "canonical_program_name", "pies", 2080 "canonical_program_name", "pies",
2081 "package", PACKAGE, 2081 "package", PACKAGE_NAME,
2082 "version", PACKAGE_VERSION, 2082 "version", PACKAGE_VERSION,
2083 NULL 2083 NULL
2084 }; 2084 };
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..93f8f46
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,6 @@
1atconfig
2atlocal
3package.m4
4testsuite
5testsuite.dir
6testsuite.log
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..668fe5e
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,71 @@
1# This file is part of GNU Pies.
2# Copyright (C) 2008-2016 Sergey Poznyakoff
3#
4# GNU Pies 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# GNU Pies 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 GNU Pies. If not, see <http://www.gnu.org/licenses/>.
16
17EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 respawn retcode mailer
18DISTCLEANFILES = atconfig $(check_SCRIPTS)
19MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
20
21## ------------ ##
22## package.m4. ##
23## ------------ ##
24
25$(srcdir)/package.m4: $(top_srcdir)/configure.ac
26 { \
27 echo '# Signature of the current package.'; \
28 echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
29 echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
30 echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
31 echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
32 echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
33 } >$(srcdir)/package.m4
34
35#
36
37## ------------ ##
38## Test suite. ##
39## ------------ ##
40
41TESTSUITE_AT = \
42 testsuite.at\
43 control.at\
44 respawn.at\
45 redirect.at\
46 ret-exec.at\
47 ret-notify.at\
48 version.at
49
50TESTSUITE = $(srcdir)/testsuite
51M4=m4
52
53AUTOTEST = $(AUTOM4TE) --language=autotest
54$(TESTSUITE): package.m4 $(TESTSUITE_AT)
55 $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
56 $(AM_V_at)mv $@.tmp $@
57
58atconfig: $(top_builddir)/config.status
59 cd $(top_builddir) && ./config.status tests/$@
60
61clean-local:
62 @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
63
64check-local: atconfig atlocal $(TESTSUITE)
65 @$(SHELL) $(TESTSUITE)
66
67# Run the test suite on the *installed* tree.
68#installcheck-local:
69# $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
70
71
diff --git a/tests/atlocal.in b/tests/atlocal.in
new file mode 100644
index 0000000..6cb3c43
--- /dev/null
+++ b/tests/atlocal.in
@@ -0,0 +1,6 @@
1# @configure_input@ -*- shell-script -*-
2# Configurable variable values for GNU Pies test suite.
3# Copyright (C) 2016 Sergey Poznyakoff
4
5PATH=@abs_builddir@:@abs_top_builddir@/src:$srcdir:$PATH
6XFAILFILE=$abs_builddir/.badversion
diff --git a/tests/control.at b/tests/control.at
new file mode 100644
index 0000000..95befdf
--- /dev/null
+++ b/tests/control.at
@@ -0,0 +1,55 @@
1# This file is part of GNU pies testsuite. -*- Autotest -*-
2# Copyright (C) 2016 Sergey Poznyakoff
3#
4# GNU pies 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# GNU pies 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 GNU pies. If not, see <http://www.gnu.org/licenses/>.
16
17AT_SETUP([Control interface])
18
19AT_CHECK([
20PIES_XFAIL_CHECK
21PIES_CONTROL_INIT
22
23pies --config-file control.conf
24
25sleep 1
26if test -f $pidfile; then
27 pid0=`head -1 $pidfile`
28 pid1=`piesctl --url "$ctlsock" id PID|sed 's/^PID: //'`
29 if test "$pid1" = "$pid0"; then
30 if piesctl --url "$ctlsock" shutdown; then
31 sleep 1
32 if test -f $pidfile; then
33 PIES_XFAIL_MSG([pies does not respond to control commands])
34 kill -9 $pid0
35 exit 1
36 else
37 exit 0
38 fi
39 else
40 PIES_XFAIL_MSG([can't send control commands])
41 kill -9 $pid0
42 exit 1
43 fi
44 else
45 PIES_XFAIL_MSG([Control interface non-functional])
46 exit 1
47 fi
48else
49 PIES_XFAIL_MSG([pies failed to start])
50 exit 1
51fi
52],
53[0])
54
55AT_CLEANUP
diff --git a/tests/mailer b/tests/mailer
new file mode 100755
index 0000000..f832ff5
--- /dev/null
+++ b/tests/mailer
@@ -0,0 +1,7 @@
1#! /bin/sh
2
3exec >${1:?}
4shift
5echo $*
6cat -
7
diff --git a/tests/redirect.at b/tests/redirect.at
new file mode 100644
index 0000000..e8d98d8
--- /dev/null
+++ b/tests/redirect.at
@@ -0,0 +1,60 @@
1# This file is part of GNU pies testsuite. -*- Autotest -*-
2# Copyright (C) 2016 Sergey Poznyakoff
3#
4# GNU pies 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.