From: John Darrington <john@darrington.wattle.id.au>
Date: Tue, 16 Dec 2003 23:44:28 +0000 (+0000)
Subject: Fixed a problem with some tests
X-Git-Tag: v0.4.0~436
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79240dcf50d4d2f9b2742ff4638d8cf8969c2f98;p=pspp-builds.git

Fixed a problem with some tests
---

diff --git a/src/cmdline.c b/src/cmdline.c
index bb9b9bab..cd29b990 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -171,7 +171,7 @@ parse_command_line (int argc, char **argv)
   if (set_testing_mode)
     {
       /* FIXME: Later this option should do some other things, too. */
-      set_viewwidth = 79;
+      set_viewwidth = 9999;
     }
 
   for (i = optind; i < argc; i++)
diff --git a/tests/command/print.sh b/tests/command/print.sh
index fbdb6c90..77daac3a 100755
--- a/tests/command/print.sh
+++ b/tests/command/print.sh
@@ -86,34 +86,26 @@ if [ $? -ne 0 ] ; then no_result ; fi
 
 
 activity="run program"
-$here/../src/pspp -o raw-ascii $TEMPDIR/print.stat > $TEMPDIR/errs
+$here/../src/pspp -o raw-ascii --testing-mode $TEMPDIR/print.stat > $TEMPDIR/errs
 # Note   vv   --- there are errors in input.  Therefore, the  command must FAIL
 if [ $? -eq 0 ] ; then fail ; fi
 
 activity="compare error messages"
-diff -w -b -B $TEMPDIR/errs - <<EOF
+diff -w $TEMPDIR/errs - <<EOF
 $TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:1: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648.  It's not possible to PRINT SPACE a
-        negative number of lines.
+$TEMPDIR/data-list.data:1: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648.  It's not possible to PRINT SPACE a negative number of lines.
 $TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:4: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648.  It's not possible to PRINT SPACE a
-        negative number of lines.
+$TEMPDIR/data-list.data:4: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648.  It's not possible to PRINT SPACE a negative number of lines.
 $TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:6: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648.  It's not possible to PRINT SPACE a
-        negative number of lines.
+$TEMPDIR/data-list.data:6: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648.  It's not possible to PRINT SPACE a negative number of lines.
 $TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
 $TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:2: warning: LIST: Missing value(s) for all variables from C onward.  These will be filled with the system-
-        missing value or blanks, as appropriate.
-$TEMPDIR/data-list.data:3: warning: LIST: Missing value(s) for all variables from B onward.  These will be filled with the system-
-        missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:2: warning: LIST: Missing value(s) for all variables from C onward.  These will be filled with the system-missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:3: warning: LIST: Missing value(s) for all variables from B onward.  These will be filled with the system-missing value or blanks, as appropriate.
 $TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:4: warning: LIST: Missing value(s) for all variables from C onward.  These will be filled with the system-
-        missing value or blanks, as appropriate.
-$TEMPDIR/data-list.data:5: warning: LIST: Missing value(s) for all variables from C onward.  These will be filled with the system-
-        missing value or blanks, as appropriate.
-$TEMPDIR/data-list.data:6: warning: LIST: Missing value(s) for all variables from B onward.  These will be filled with the system-
-        missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:4: warning: LIST: Missing value(s) for all variables from C onward.  These will be filled with the system-missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:5: warning: LIST: Missing value(s) for all variables from C onward.  These will be filled with the system-missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:6: warning: LIST: Missing value(s) for all variables from B onward.  These will be filled with the system-missing value or blanks, as appropriate.
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
diff --git a/tests/command/sort.sh b/tests/command/sort.sh
new file mode 100755
index 00000000..0f7dd177
--- /dev/null
+++ b/tests/command/sort.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+# This program tests the sort command
+
+TEMPDIR=/tmp/pspp-tst-$$
+
+here=`pwd`;
+
+# ensure that top_srcdir is absolute
+cd $top_srcdir; top_srcdir=`pwd`
+
+export STAT_CONFIG_PATH=$top_srcdir/config
+
+
+cleanup()
+{
+     rm -rf $TEMPDIR
+}
+
+
+fail()
+{
+    echo $activity
+    echo FAILED
+    cleanup;
+    exit 1;
+}
+
+
+no_result()
+{
+    echo $activity
+    echo NO RESULT;
+    cleanup;
+    exit 2;
+}
+
+pass()
+{
+    cleanup;
+    exit 0;
+}
+
+mkdir -p $TEMPDIR
+
+cd $TEMPDIR
+
+
+activity="generate stat program"
+cat > $TEMPDIR/sort.stat <<EOF
+title 'Test SORT procedure'.
+
+data list file='$here/sort.data' notable /X000 to X126 1-127(a).
+sort by X000 to x005.
+print /X000 to X005.
+execute.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="run program"
+$here/../src/pspp -o raw-ascii $TEMPDIR/sort.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+# Now there should be some sorted data in $TEMPDIR/pspp.list
+# We have to do some checks on it.
+
+# 1. Is it sorted ?
+
+activity="check sorted"
+sort $TEMPDIR/pspp.list  > $TEMPDIR/sortsort
+if [ $? -ne 0 ] ; then no_result ; fi
+
+diff -B -b $TEMPDIR/sortsort $TEMPDIR/pspp.list
+if [ $? -ne 0 ] ; then fail ; fi
+
+# 2. It should be six elements wide
+activity="check data width"
+awk '!/^\ *$/{if (NF!=6) exit 1}' $TEMPDIR/pspp.list 
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass;