summaryrefslogtreecommitdiffabout
path: root/tests/ret-notify.at
Unidiff
Diffstat (limited to 'tests/ret-notify.at') (more/less context) (ignore whitespace changes)
-rw-r--r--tests/ret-notify.at68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/ret-notify.at b/tests/ret-notify.at
new file mode 100644
index 0000000..2119ed5
--- a/dev/null
+++ b/tests/ret-notify.at
@@ -0,0 +1,68 @@
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([Notify on return code])
18AT_KEYWORDS([ret-notify])
19
20AT_CHECK([
21PIES_XFAIL_CHECK
22PIES_CONTROL_INIT
23report_file=$PWD/report
24cat > pies.conf <<_EOT
25mailer-program "$abs_srcdir/mailer";
26mailer-command-line "$abs_srcdir/mailer $report_file";
27component test {
28 mode respawn;
29 return-code 10 {
30 notify root;
31 action disable;
32 }
33 command "$abs_srcdir/respawn -sleep 2 -exit 10";
34}
35_EOT
36
37>$report_file
38
39pies --config-file control.conf --config-file pies.conf
40
41n=0
42while test ! -s $report_file
43do
44 sleep 1
45 n=$(($n + 1))
46 if test $n -gt 4; then
47 echo >&2 "timed out"
48 break
49 fi
50done
51sleep 1
52PIES_STOP
53
54if test -f $report_file; then
55 cat $report_file
56else
57 echo >&2 "no report file"
58fi
59],
60[0],
61[root
62From: <>
63X-Agent: pies (AT_PACKAGE_NAME AT_PACKAGE_VERSION)
64Subject: Component test exited with code 10.
65
66])
67
68AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.