pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/tests automake.mk bugs/unwritable-dir.sh


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/tests automake.mk bugs/unwritable-dir.sh
Date: Fri, 21 Sep 2007 14:18:08 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Changes by:     Ben Pfaff <blp> 07/09/21 14:18:08

Modified files:
        tests          : automake.mk 
Added files:
        tests/bugs     : unwritable-dir.sh 

Log message:
        New test for bug #21117.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/tests/automake.mk?cvsroot=pspp&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/pspp/tests/bugs/unwritable-dir.sh?cvsroot=pspp&rev=1.1

Patches:
Index: automake.mk
===================================================================
RCS file: /cvsroot/pspp/pspp/tests/automake.mk,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- automake.mk 5 Sep 2007 06:23:04 -0000       1.37
+++ automake.mk 21 Sep 2007 14:18:08 -0000      1.38
@@ -111,6 +111,7 @@
        tests/bugs/t-test-alpha.sh \
        tests/bugs/t-test-alpha2.sh \
        tests/bugs/temporary.sh \
+       tests/bugs/unwritable-dir.sh \
        tests/bugs/val-labs.sh \
        tests/bugs/val-labs-trailing-slash.sh \
        tests/bugs/recode-copy-bug.sh \

Index: bugs/unwritable-dir.sh
===================================================================
RCS file: bugs/unwritable-dir.sh
diff -N bugs/unwritable-dir.sh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ bugs/unwritable-dir.sh      21 Sep 2007 14:18:08 -0000      1.1
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+# This program tests for a bug which crashed pspp when output drivers
+# tried to create output files in an unwritable directory.
+
+TEMPDIR=/tmp/pspp-tst-$$
+
+# 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
+
+# ensure that top_srcdir is absolute
+top_srcdir=`cd $top_srcdir; pwd`
+
+STAT_CONFIG_PATH=$top_srcdir/config
+export STAT_CONFIG_PATH
+
+
+cleanup()
+{
+     cd /
+     chmod u+w $TEMPDIR
+     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="create test syntax"
+cat > test.pspp <<EOF
+* By including at least one command in the input, we can ensure that PSPP
+  also doesn't crash trying to create pspp.jnl in an unwritable directory.
+
+* By outputting a chart, we can check that charts are safe too.
+
+data list /x 1.
+begin data.
+1
+2
+3
+end data.
+frequencies x/histogram.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+# Mark our directory unwritable.
+chmod u-w $TEMPDIR
+
+# Iterate over the various drivers we support.  We could use all of these
+# on a single PSPP invocation, except that charts are only supported for
+# a single driver at a time, and we'd prefer to test chart support for
+# all of our driver types.
+for driver in list-ascii list-ps html; do
+    # PSPP will fail to create the output file.  Currently this doesn't cause
+    # PSPP's exit status to be nonzero, although this is arguably incorrect.
+    # At any rate, PSPP should not crash.
+    activity="run pspp with $driver driver"
+    $SUPERVISOR $PSPP -o $driver test.pspp >/dev/null 2>&1
+    if [ $? -ne 0 ] ; then fail ; fi
+done
+
+pass;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]