From c82f56ffe5523ab8dce155446b614da8f2d42080 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 6 Mar 2010 11:54:11 -0800 Subject: [PATCH] CROSSTABS: Rewrite tests in Autotest and add test for bug #27883. --- tests/automake.mk | 7 +- tests/bugs/crosstabs-crash.sh | 105 ----------- tests/bugs/crosstabs-crash2.sh | 107 ------------ tests/bugs/crosstabs.sh | 91 ---------- tests/bugs/crosstabs2.sh | 112 ------------ tests/language/stats/crosstabs.at | 277 ++++++++++++++++++++++++++++++ tests/testsuite.at | 1 + 7 files changed, 280 insertions(+), 420 deletions(-) delete mode 100755 tests/bugs/crosstabs-crash.sh delete mode 100755 tests/bugs/crosstabs-crash2.sh delete mode 100755 tests/bugs/crosstabs.sh delete mode 100755 tests/bugs/crosstabs2.sh create mode 100644 tests/language/stats/crosstabs.at diff --git a/tests/automake.mk b/tests/automake.mk index dcfbf233..351922ec 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -109,10 +109,6 @@ dist_TESTS = \ tests/bugs/comment-at-eof.sh \ tests/bugs/compute-fmt.sh \ tests/bugs/compression.sh \ - tests/bugs/crosstabs.sh \ - tests/bugs/crosstabs2.sh \ - tests/bugs/crosstabs-crash.sh \ - tests/bugs/crosstabs-crash2.sh \ tests/bugs/curtailed.sh \ tests/bugs/data-crash.sh \ tests/bugs/double-frequency.sh \ @@ -419,13 +415,14 @@ EXTRA_DIST += \ $(TESTSUITE) TESTSUITE_AT = \ tests/testsuite.at \ + tests/language/stats/crosstabs.at \ tests/output/render.at TESTSUITE = $(srcdir)/tests/testsuite DISTCLEANFILES += tests/atconfig tests/atlocal $(TESTSUITE) CHECK_LOCAL += tests_check tests_check: tests/atconfig tests/atlocal $(TESTSUITE) - $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=tests/output $(TESTSUITEFLAGS) + $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=tests/output:src/ui/terminal $(TESTSUITEFLAGS) CLEAN_LOCAL += tests_clean tests_clean: diff --git a/tests/bugs/crosstabs-crash.sh b/tests/bugs/crosstabs-crash.sh deleted file mode 100755 index 5bebfed5..00000000 --- a/tests/bugs/crosstabs-crash.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh - -# This program tests for a bug which caused CROSSTABS to crash in -# integer mode. - -TEMPDIR=/tmp/pspp-tst-$$ -TESTFILE=$TEMPDIR/`basename $0`.sps - -# 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 - -LANG=C -export LANG - -cleanup() -{ - if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then - echo "NOT cleaning $TEMPDIR" - return ; - fi - cd / - 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 program" -cat > $TESTFILE < $TESTFILE < /dev/null -if [ $? -ne 0 ] ; then no_result ; fi - -diff -c $TEMPDIR/pspp.csv - << EOF -Table: Reading free-form data from INLINE. -Variable,Format -x,F8.0 -y,A18 - -"$TEMPDIR/crosstabs-crash2.sh.sps:4: warning: BEGIN DATA: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate." - -"$TEMPDIR/crosstabs-crash2.sh.sps:6: warning: BEGIN DATA: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate." - -Table: Summary. -,Cases,,,,, -,Valid,,Missing,,Total, -,N,Percent,N,Percent,N,Percent -x * y,4,66.7%,2,33.3%,6,100.0% - -Table: x * y [count]. -,y,,,, -x,one unity ,three lots ,two duality ,zero none ,Total -1.00,1.0,.0,.0,1.0,2.0 -2.00,.0,.0,1.0,.0,1.0 -3.00,.0,1.0,.0,.0,1.0 -Total,1.0,1.0,1.0,1.0,4.0 -EOF -if [ $? -ne 0 ] ; then fail ; fi - -pass; diff --git a/tests/bugs/crosstabs.sh b/tests/bugs/crosstabs.sh deleted file mode 100755 index 6f02a508..00000000 --- a/tests/bugs/crosstabs.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh - -# This program tests for a bug which crashed pspp when doing a crosstabs - -TEMPDIR=/tmp/pspp-tst-$$ -TESTFILE=$TEMPDIR/`basename $0`.sps - -# 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() -{ - if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then - echo "NOT cleaning $TEMPDIR" - return ; - fi - cd / - 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 program" -cat > $TEMPDIR/ct.stat < $TESTFILE <