Add copyright and licence notices to files which lack them.
[pspp] / tests / data / file.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
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.
8 dnl 
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.
13 dnl 
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/>.
16 dnl AT_BANNER([files handling])
17
18 AT_SETUP([Write error - directory exists])
19
20 mkdir foobar.sav
21
22 AT_DATA([file.sps], [dnl
23 DATA LIST NOTABLE/x 1.
24 BEGIN DATA.
25 5
26 END DATA.
27 SAVE OUTFILE='foobar.sav'.
28 ])
29
30 AT_CHECK([pspp -O format=csv file.sps], [1], [dnl
31 error: Opening foobar.sav for writing: Is a directory.
32
33 error: Error opening `foobar.sav' for writing as a system file: Is a directory.
34 ])
35
36 AT_CLEANUP
37
38
39 AT_SETUP([Write error - no permission])
40
41 mkdir  directory
42 touch directory/foobar.sav
43 chmod 000 directory
44
45 AT_DATA([file.sps], [dnl
46 DATA LIST NOTABLE/x 1.
47 BEGIN DATA.
48 5
49 END DATA.
50 SAVE OUTFILE='directory/foobar.sav'.
51 ])
52
53 AT_CHECK([pspp -O format=csv file.sps], [1], [dnl
54 error: Creating temporary file to replace directory/foobar.sav: Permission denied.
55
56 error: Error opening `directory/foobar.sav' for writing as a system file: Permission denied.
57 ])
58
59 chmod 700 directory
60
61 AT_CLEANUP
62
63
64
65 AT_SETUP([Write error - temp file disappeared])
66
67 AT_DATA([file.sps], [dnl
68 DATA LIST NOTABLE/x 1.
69 BEGIN DATA.
70 5
71 END DATA.
72 XSAVE OUTFILE='foobar.sav'.
73 HOST COMMAND=[['rm foobar.savtmp*']].
74 EXECUTE.
75 ])
76
77 AT_CHECK([pspp -O format=csv file.sps], [1], [ignore])
78
79 AT_CLEANUP
80
81
82
83 AT_SETUP([Write fifo])
84
85 dnl The Fifo feature is not available in w32 builds
86 AT_SKIP_IF([case $host in *-*-mingw*) true ;; *) false ;; esac])
87
88 AT_DATA([file.sps], [dnl
89 DATA LIST NOTABLE/x 1.
90 BEGIN DATA.
91 5
92 END DATA.
93 SAVE OUTFILE='foobar.sav'.
94 ])
95
96 mkfifo foobar.sav
97 cat foobar.sav > /dev/null & 
98 pid=$!
99
100 AT_CHECK([pspp -O format=csv file.sps], [0], [ignore])
101
102 AT_CLEANUP
103
104
105
106 AT_SETUP([Reading from pipe])
107
108 AT_DATA([pipe.sps], [dnl
109 data list file='printf "1 2\n 3 4\n 5 6\n" |' notable list /x * y *.
110 list.
111 ])
112
113 AT_CHECK([pspp -O format=csv pipe.sps], [0], [dnl
114 Table: Data List
115 x,y
116 1.00,2.00
117 3.00,4.00
118 5.00,6.00
119 ])
120
121 AT_CLEANUP