From: Ben Pfaff Date: Fri, 21 Sep 2007 14:18:08 +0000 (+0000) Subject: New test for bug #21117. X-Git-Tag: v0.6.0~258 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7158580a14ebc9c9b4e44a537ecb1ea878c9e646;p=pspp-builds.git New test for bug #21117. --- diff --git a/tests/automake.mk b/tests/automake.mk index d2648e53..1b7a38ac 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -111,6 +111,7 @@ dist_TESTS = \ 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 \ diff --git a/tests/bugs/unwritable-dir.sh b/tests/bugs/unwritable-dir.sh new file mode 100755 index 00000000..705c45b9 --- /dev/null +++ b/tests/bugs/unwritable-dir.sh @@ -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 </dev/null 2>&1 + if [ $? -ne 0 ] ; then fail ; fi +done + +pass;