tests/formats/wkday-in.sh \
tests/formats/wkday-out.sh \
tests/formats/360.sh \
- tests/bugs/unwritable-dir.sh \
tests/bugs/val-labs.sh \
tests/bugs/val-labs-trailing-slash.sh \
tests/bugs/keep-all.sh \
tests/libpspp/stringi-set.at \
tests/libpspp/tower.at \
tests/math/moments.at \
- tests/output/render.at \
tests/output/charts.at \
+ tests/output/output.at \
+ tests/output/render.at \
tests/ui/terminal/main.at \
tests/perl-module.at
+++ /dev/null
-#!/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$EXEEXT
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-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 /
- 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 file in pspp.csv pspp.html pspp.odt pspp.pdf pspp.txt; 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 $file driver"
- $SUPERVISOR $PSPP -o $file test.pspp >/dev/null 2>&1
- if [ $? -ne 0 ] ; then fail ; fi
-done
-
-pass;
--- /dev/null
+AT_BANNER([output drivers])
+
+m4_define([OUTPUT_UNWRITABLE_DIR],
+ [AT_SETUP([output $1 to unwritable directory])
+ mkdir unwritable
+ chmod u-w unwritable
+ AT_SKIP_IF([: > unwritable/test])
+ AT_DATA([unwritable.sps], [dnl
+data list /x 1.
+begin data.
+1
+2
+3
+end data.
+frequencies x/histogram.
+])
+ dnl PSPP will fail to create the output file. Currently this doesn't cause
+ dnl PSPP's exit status to be nonzero, although this is arguably incorrect.
+ dnl At any rate, PSPP should not crash.
+ AT_CHECK([cd unwritable && pspp -o pspp.$1 ../unwritable.sps], [0],
+ [ignore], [ignore])
+ AT_CLEANUP])
+
+OUTPUT_UNWRITABLE_DIR([csv])
+OUTPUT_UNWRITABLE_DIR([html])
+OUTPUT_UNWRITABLE_DIR([odt])
+OUTPUT_UNWRITABLE_DIR([pdf])
+OUTPUT_UNWRITABLE_DIR([txt])