3 # This program tests the INSERT command
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_srcdir and top_builddir are absolute
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 top_srcdir=`cd $top_srcdir; pwd`
12 top_builddir=`cd $top_builddir; pwd`
14 PSPP=$top_builddir/src/ui/terminal/pspp
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
61 activity="create wrapper 1"
64 FILE='$TEMPDIR/foo.sps'
72 if [ $? -ne 0 ] ; then no_result ; fi
74 #The following syntax intentionally omits periods from some lines
75 #It's an example of "batch" syntax
76 activity="create insert"
77 cat <<EOF > $TEMPDIR/foo.sps
87 if [ $? -ne 0 ] ; then no_result ; fi
90 #This command should fail
91 activity="run program 1"
92 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
93 if [ $? -eq 0 ] ; then fail ; fi
96 activity="create wrapper 2"
99 FILE='$TEMPDIR/foo.sps'
107 if [ $? -ne 0 ] ; then no_result ; fi
109 activity="run program 2"
110 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
111 if [ $? -ne 0 ] ; then fail ; fi
114 # Now test the CD subcommand
118 if [ $? -ne 0 ] ; then no_result ; fi
120 activity="create wrapper 3"
121 cat <<EOF > $TESTFILE
123 FILE='$TEMPDIR/Dir1/foo.sps'
131 if [ $? -ne 0 ] ; then no_result ; fi
133 activity="create wrapper 4"
134 cat <<EOF > $TEMPDIR/Dir1/foo.sps
141 if [ $? -ne 0 ] ; then no_result ; fi
143 activity="create wrapper 5"
144 cat <<EOF > $TEMPDIR/Dir1/bar.sps
153 if [ $? -ne 0 ] ; then no_result ; fi
156 # This command should fail
157 activity="run program 3"
158 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
159 if [ $? -eq 0 ] ; then fail ; fi
161 activity="create wrapper 6"
162 cat <<EOF > $TESTFILE
164 FILE='$TEMPDIR/Dir1/foo.sps'
171 if [ $? -ne 0 ] ; then no_result ; fi
173 activity="run program 4"
174 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
175 if [ $? -ne 0 ] ; then fail ; fi
178 # Now test the ERROR= feature
180 activity="create wrapper 7"
181 cat <<EOF > $TESTFILE
183 FILE='$TEMPDIR/foo.sps'
190 if [ $? -ne 0 ] ; then no_result ; fi
193 activity="create included file"
194 cat <<EOF > $TEMPDIR/foo.sps
195 DATA LIST NOTABLE LIST /x *.
202 * The following line is erroneous
207 if [ $? -ne 0 ] ; then no_result ; fi
209 activity="run program 5"
210 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
211 if [ $? -ne 1 ] ; then no_result ; fi
213 activity="examine output 1"
214 diff $TEMPDIR/pspp.list - <<EOF
215 $TEMPDIR/foo.sps:10: error: DISPLAY: AKSDJ is not a variable name.
216 warning: Error encountered while ERROR=STOP is effective.
217 $TEMPDIR/foo.sps:10: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
220 if [ $? -ne 0 ] ; then fail ; fi
223 activity="create wrapper 8"
224 cat <<EOF > $TESTFILE
226 FILE='$TEMPDIR/foo.sps'
233 if [ $? -ne 0 ] ; then no_result ; fi
235 activity="run program 6"
236 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
237 if [ $? -ne 1 ] ; then no_result ; fi
239 activity="examine output 2"
240 diff $TEMPDIR/pspp.list - <<EOF
241 $TEMPDIR/foo.sps:10: error: DISPLAY: AKSDJ is not a variable name.
250 if [ $? -ne 0 ] ; then fail ; fi