diff options
Diffstat (limited to 'tests/control.at')
-rw-r--r-- | tests/control.at | 55 |
1 files changed, 55 insertions, 0 deletions
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 | |||
17 | AT_SETUP([Control interface]) | ||
18 | |||
19 | AT_CHECK([ | ||
20 | PIES_XFAIL_CHECK | ||
21 | PIES_CONTROL_INIT | ||
22 | |||
23 | pies --config-file control.conf | ||
24 | |||
25 | sleep 1 | ||
26 | if 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 | ||
48 | else | ||
49 | PIES_XFAIL_MSG([pies failed to start]) | ||
50 | exit 1 | ||
51 | fi | ||
52 | ], | ||
53 | [0]) | ||
54 | |||
55 | AT_CLEANUP | ||