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([portable files])
19 AT_SETUP([overwriting portable file])
20 AT_DATA([output.por], [abcdef
22 cp output.por output.por.backup
23 AT_DATA([porfile.sps], [dnl
24 DATA LIST NOTABLE/x 1.
28 EXPORT OUTFILE='output.por'.
30 AT_CHECK([pspp -O format=csv porfile.sps])
31 AT_CHECK([cmp output.por output.por.backup], [1], [ignore])
34 AT_SETUP([overwriting portable file atomically])
35 AT_DATA([output.por], [abcdef
37 cp output.por output.por.backup
38 AT_DATA([porfile.sps],
39 [[DATA LIST NOTABLE/x 1.
43 XEXPORT OUTFILE='output.por'.
44 HOST COMMAND=['kill -TERM $PPID'].
46 AT_CHECK([pspp -O format=csv porfile.sps], [143], [], [ignore])
47 AT_CHECK([cmp output.por output.por.backup])
49 [for file in *.tmp*; do if test -e $file; then echo $file; exit 1; fi; done])
52 AT_SETUP([write to same portable file being read])
53 AT_DATA([export.sps], [dnl
54 DATA LIST NOTABLE/x 1.
58 EXPORT OUTFILE='data.por'.
60 AT_CHECK([pspp -O format=csv export.sps])
61 AT_CHECK([test -s data.por])
63 [for file in *.tmp*; do if test -e $file; then echo $file; exit 1; fi; done])
64 AT_DATA([export2.sps], [dnl
65 IMPORT FILE='data.por'.
67 EXPORT OUTFILE='data.por'.
69 AT_CHECK([pspp -O format=csv export2.sps])
71 [for file in *.tmp*; do if test -e $file; then echo $file; exit 1; fi; done])
72 AT_DATA([export3.sps], [dnl
73 IMPORT FILE='data.por'.
76 AT_CHECK([pspp -O format=csv export3.sps], [0], [dnl
83 dnl This checks for a bug in the portable file writer that caused an infinite
84 dnl loop in some cases, and other problems in other cases, when a variable
86 AT_SETUP([write portable file with value labels])
87 AT_DATA([export.sps], [dnl
88 DATA LIST NOTABLE/var1 TO var5 1-5.
98 EXPORT OUTFILE='data.por'.
100 AT_CHECK([pspp -O format=csv export.sps])
101 AT_DATA([import.sps], [dnl
102 IMPORT FILE='data.por'.
106 AT_CHECK([pspp -O format=csv import.sps], [0], [dnl
108 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
109 VAR1,1,,Scale,Input,8,Right,F1.0,F1.0,
110 VAR2,2,,Scale,Input,8,Right,F1.0,F1.0,
111 VAR3,3,,Scale,Input,8,Right,F1.0,F1.0,
112 VAR4,4,,Scale,Input,8,Right,F1.0,F1.0,
113 VAR5,5,,Scale,Input,8,Right,F1.0,F1.0,
116 Variable Value,,Label
124 VAR1,VAR2,VAR3,VAR4,VAR5
127 AT_DATA([sys-file-info.sps], [SYSFILE INFO FILE='data.por'
129 AT_CHECK([pspp -O format=csv sys-file-info.sps | sed '/Encoding/d
135 Table: File Information
140 Type,SPSS Portable File
145 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
146 VAR1,1,,Scale,Input,8,Right,F1.0,F1.0,
147 VAR2,2,,Scale,Input,8,Right,F1.0,F1.0,
148 VAR3,3,,Scale,Input,8,Right,F1.0,F1.0,
149 VAR4,4,,Scale,Input,8,Right,F1.0,F1.0,
150 VAR5,5,,Scale,Input,8,Right,F1.0,F1.0,
153 Variable Value,,Label