aboutsummaryrefslogtreecommitdiff
path: root/tests/shutdown.at
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-05-24 17:07:22 +0300
committerSergey Poznyakoff <gray@gnu.org>2019-05-24 17:10:34 +0300
commita8d45eff28e7e186d0749e3e9cf980a23d93231e (patch)
tree50eb85966b6d87f73128728dab876e36dcc67799 /tests/shutdown.at
parent2ba31eb953d18bb818a87caddcbca80bc8a1d37d (diff)
downloadpies-a8d45eff28e7e186d0749e3e9cf980a23d93231e.tar.gz
pies-a8d45eff28e7e186d0749e3e9cf980a23d93231e.tar.bz2
Implement shutdown components
* src/pies.h: Update comment. * src/progman.c (register_prog0): Register shutdown components in disabled state. (program_shutdown): New function. (progman_stop): Call program_shutdown. * tests/shutdown.at: New test. * tests/Makefile.am: Add new test. * tests/testsuite.at: Likewise. * tests/aux/startup: Rename to tests/aux/touchfile * tests/startup.at: Reflect the change.
Diffstat (limited to 'tests/shutdown.at')
-rw-r--r--tests/shutdown.at58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/shutdown.at b/tests/shutdown.at
new file mode 100644
index 0000000..79bec37
--- /dev/null
+++ b/tests/shutdown.at
@@ -0,0 +1,58 @@
1# This file is part of GNU pies testsuite. -*- Autotest -*-
2# Copyright (C) 2019 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([Shutdown components])
18
19AT_CHECK([
20PIES_XFAIL_CHECK
21PIES_CONTROL_INIT
22comp_pid_file=$PWD/comp.pid
23
24cat > pies.conf <<_EOT
25component s {
26 mode shutdown;
27 command "$auxdir/touchfile $PWD 0 shutdown";
28}
29
30component test {
31 mode respawn;
32 command "$auxdir/respawn -append -pid $comp_pid_file";
33}
34_EOT
35
36pies --config-file control.conf --config-file pies.conf
37
38n=0
39while :
40do
41 if test -f $comp_pid_file; then
42 break
43 fi
44 sleep 1
45 n=$(($n + 1))
46 if test $n -gt 10; then
47 echo >&2 "timed out"
48 break
49 fi
50done
51
52PIES_STOP
53
54test -f shutdown
55])
56
57AT_CLEANUP
58

Return to:

Send suggestions and report system problems to the System administrator.