SPLIT FILE: Convert test to Autotest framework.
[pspp-builds.git] / tests / command / t-test-1-sample-missing-list.sh
index 437725dd94452158275f18e757c42b423b668fbf..558a42a6bb6d5da8df7cfa34e1a401b04a5dcf93 100755 (executable)
@@ -4,17 +4,28 @@
 # when there are listwise missing values involved.
 
 TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
 
-here=`pwd`;
+# ensure that top_builddir  are absolute
+if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
+if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
+top_builddir=`cd $top_builddir; pwd`
+PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
 
 # ensure that top_srcdir is absolute
-cd $top_srcdir; top_srcdir=`pwd`
+top_srcdir=`cd $top_srcdir; pwd`
 
-export STAT_CONFIG_PATH=$top_srcdir/config
+STAT_CONFIG_PATH=$top_srcdir/config
+export STAT_CONFIG_PATH
 
 
 cleanup()
 {
+     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
+       echo "NOT cleaning $TEMPDIR" 
+       return ; 
+     fi
+     cd /
      rm -rf $TEMPDIR
 }
 
@@ -47,7 +58,7 @@ mkdir -p $TEMPDIR
 cd $TEMPDIR
 
 activity="create program 1"
-cat > $TEMPDIR/out.stat <<EOF
+cat > $TESTFILE <<EOF
 data list list /id * x1 * x2.
 begin data.
 1 3.5 34
@@ -63,16 +74,16 @@ if [ $? -ne 0 ] ; then no_result ; fi
 
 
 activity="run program 1"
-$here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
 if [ $? -ne 0 ] ; then no_result ; fi
 
 activity="copy output"
-cp $TEMPDIR/pspp.list $TEMPDIR/ref.list
+cp $TEMPDIR/pspp.csv $TEMPDIR/ref.csv
 if [ $? -ne 0 ] ; then no_result ; fi
 
 
 activity="create program 2"
-cat > $TEMPDIR/out.stat <<EOF
+cat > $TESTFILE <<EOF
 data list list /id * x1 * x2.
 begin data.
 1 3.5 34
@@ -90,11 +101,11 @@ EOF
 if [ $? -ne 0 ] ; then no_result ; fi
 
 activity="run program 2"
-$here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
 if [ $? -ne 0 ] ; then no_result ; fi
 
 activity="compare outputs"
-diff $TEMPDIR/ref.list $TEMPDIR/pspp.list
+diff $TEMPDIR/ref.csv $TEMPDIR/pspp.csv
 if [ $? -ne 0 ] ; then fail ; fi