3 # This program tests for a bug that caused SAVE to the file currently
4 # being read with GET to truncate the save file to zero length, and
5 # similarly for IMPORT/EXPORT.
8 TEMPDIR=/tmp/pspp-tst-$$
9 TESTFILE=$TEMPDIR/`basename $0`.sps
11 # ensure that top_builddir are absolute
12 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
13 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
14 top_builddir=`cd $top_builddir; pwd`
15 PSPP=$top_builddir/src/ui/terminal/pspp
17 # ensure that top_srcdir is absolute
18 top_srcdir=`cd $top_srcdir; pwd`
20 STAT_CONFIG_PATH=$top_srcdir/config
21 export STAT_CONFIG_PATH
58 activity="create program 1"
69 SAVE OUTFILE='foo.sav'.
70 EXPORT OUTFILE='foo.por'.
72 if [ $? -ne 0 ] ; then no_result ; fi
75 activity="run program 1"
76 $SUPERVISOR $PSPP --testing-mode $TESTFILE
77 if [ $? -ne 0 ] ; then no_result ; fi
80 activity="check and save copy of output files"
81 # Check that the files are nonzero length.
82 test -s foo.sav || fail
83 test -s foo.por || fail
84 # Save copies of them.
85 cp foo.sav foo.sav.backup || fail
86 cp foo.por foo.por.backup || fail
89 activity="create program 2"
92 SAVE OUTFILE='foo.sav'.
94 if [ $? -ne 0 ] ; then no_result ; fi
97 activity="run program 2"
98 $SUPERVISOR $PSPP --testing-mode $TESTFILE -e /dev/null
99 # This should have failed with an error message.
100 if [ $? -eq 0 ] ; then no_result ; fi
103 activity="create program 3"
104 cat > $TESTFILE <<EOF
106 EXPORT OUTFILE='foo.por'.
108 if [ $? -ne 0 ] ; then no_result ; fi
111 activity="run program 3"
112 $SUPERVISOR $PSPP --testing-mode $TESTFILE -e /dev/null
113 # This should have failed with an error message.
114 if [ $? -eq 0 ] ; then no_result ; fi
117 activity="compare output 1"
118 cmp foo.sav foo.sav.backup
119 if [ $? -ne 0 ] ; then fail ; fi
121 activity="compare output 2"
122 cmp foo.por foo.por.backup
123 if [ $? -ne 0 ] ; then fail ; fi