1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
17 AT_BANNER([HOST - portable tests])
19 AT_SETUP([HOST - one command])
20 AT_DATA([host.sps], [dnl
21 HOST COMMAND=[['echo "hi there" > file']].
23 AT_CHECK([pspp -O format=csv host.sps])
24 AT_CHECK([cat file], [0], [hi there
28 AT_SETUP([HOST - two commands])
29 AT_DATA([host.sps], [dnl
30 HOST COMMAND=[['echo a > a' 'echo b > b']].
32 AT_CHECK([pspp -O format=csv host.sps])
33 AT_CHECK([cat a], [0], [a
35 AT_CHECK([cat b], [0], [b
39 AT_SETUP([HOST - time limit])
40 AT_DATA([host.sps], [dnl
41 HOST COMMAND=[['sleep 10']] TIMELIMIT=0.1.
44 AT_CHECK([pspp -O format=csv host.sps], [1], [dnl
45 host.sps:1: error: HOST: Time limit not supported on this platform.
48 AT_CHECK([pspp -O format=csv host.sps], [0], [dnl
49 "host.sps:1: warning: HOST: Command ""sleep 10"" timed out."
54 AT_BANNER([HOST - Unix-like OSes only])
56 AT_SETUP([HOST - command failure])
58 AT_DATA([host.sps], [dnl
59 HOST COMMAND=[['exit 1' 'echo "Not reached"']].
61 AT_CHECK([pspp -O format=csv host.sps], [0], [dnl
62 "host.sps:1: warning: HOST: Command ""exit 1"" exited with status 1."
66 AT_SETUP([HOST - nonexistent shell])
68 AT_DATA([host.sps], [dnl
69 HOST COMMAND=[['echo hi']].
71 AT_CHECK([SHELL=/nonexistent pspp -O format=csv host.sps], [0], [dnl
72 "host.sps:1: warning: HOST: Command ""echo hi"" exited with status 127 (Command or shell not found)."
76 AT_SETUP([HOST - nonexistent command])
78 AT_DATA([host.sps], [dnl
79 HOST COMMAND=[['/nonexistent']].
81 AT_CHECK([pspp -O format=csv host.sps | head -1], [0], [dnl
82 "host.sps:1: warning: HOST: Command ""/nonexistent"" exited with status 127 (Command or shell not found)."
86 AT_SETUP([HOST - output to stdout])
88 AT_DATA([host.sps], [dnl
89 HOST COMMAND=[['echo hi']].
91 AT_CHECK([pspp -O format=csv host.sps], [0], [hi
95 AT_SETUP([HOST - output to stderr])
97 AT_DATA([host.sps], [dnl
98 HOST COMMAND=[['echo hi 2>&1']].
100 AT_CHECK([pspp -O format=csv host.sps], [0], [hi
104 AT_SETUP([HOST - input from stdin])
106 AT_DATA([host.sps], [dnl
107 HOST COMMAND=[['cat && echo ok || echo fail']] TIMELIMIT=5.
109 AT_CHECK([pspp -O format=csv host.sps], [0], [ok
113 dnl This is a special case inside run_command().
114 AT_SETUP([HOST - zero time limit])
116 AT_DATA([host.sps], [dnl
117 HOST COMMAND=[['sleep 10']] TIMELIMIT=0.
119 AT_CHECK([pspp -O format=csv host.sps], [0], [dnl
120 "host.sps:1: warning: HOST: Command ""sleep 10"" timed out."
124 AT_SETUP([HOST - signal termination])
126 AT_DATA([host.sps], [dnl
127 HOST COMMAND=[['kill -ABRT $$' 'echo "Not reached"']].
129 AT_CHECK([pspp -O format=csv host.sps], [0], [dnl
130 "host.sps:1: warning: HOST: Command ""kill -ABRT $$"" terminated by signal 6."
134 AT_SETUP([HOST - SAFER])
136 AT_DATA([host.sps], [dnl
138 HOST COMMAND=[['sleep 10']] TIMELIMIT=0.1.
140 AT_CHECK([pspp -O format=csv host.sps], [1], [dnl
141 host.sps:2: error: HOST: This command not allowed when the SAFER option is set.