Checkin of new directory structure.
[pspp-builds.git] / tests / command / split-file.sh
index 47f2fa883d0f8410b0bdb1f62db1ade732dba917..d1942b01749b4236fadd11abfdb169121bd2bb38 100755 (executable)
@@ -5,16 +5,21 @@
 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`
 
 # 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()
 {
+     cd /
      rm -rf $TEMPDIR
 }
 
@@ -72,14 +77,14 @@ EOF
 if [ $? -ne 0 ] ; then no_result ; fi
 
 activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/split.stat
+$SUPERVISOR $top_builddir/src/pspp -o raw-ascii $TEMPDIR/split.stat
 if [ $? -ne 0 ] ; then no_result ; fi
 
 activity="compare results"
-diff -B -b $TEMPDIR/pspp.list - <<EOF
+perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
+diff  -b $TEMPDIR/pspp.list - <<EOF
 Variable Value Label
 X            1
-
 X Y
 - -
 1 2 
@@ -88,10 +93,8 @@ X Y
 1 9 
 1 5 
 1 4 
-
 Variable Value Label
 X            2
-
 X Y
 - -
 2 7