From f368e65edf078d4d9073d56533f6c1780fdcc3bb Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 29 Sep 2010 20:30:24 -0700 Subject: [PATCH] LAG: Convert tests to use Autotest. --- tests/automake.mk | 2 - tests/bugs/lag_crash.sh | 81 -------------------- tests/command/lag.sh | 100 ------------------------- tests/language/expressions/evaluate.at | 56 ++++++++++++++ 4 files changed, 56 insertions(+), 183 deletions(-) delete mode 100755 tests/bugs/lag_crash.sh delete mode 100755 tests/command/lag.sh diff --git a/tests/automake.mk b/tests/automake.mk index 125b0b79..986e9ec2 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT) dist_TESTS = \ - tests/command/lag.sh \ tests/command/line-ends.sh \ tests/command/list.sh \ tests/command/loop.sh \ @@ -85,7 +84,6 @@ dist_TESTS = \ tests/bugs/get-no-file.sh \ tests/bugs/if_crash.sh \ tests/bugs/input-crash.sh \ - tests/bugs/lag_crash.sh \ tests/bugs/list-overflow.sh \ tests/bugs/match-files-scratch.sh \ tests/bugs/multipass.sh \ diff --git a/tests/bugs/lag_crash.sh b/tests/bugs/lag_crash.sh deleted file mode 100755 index c98864c4..00000000 --- a/tests/bugs/lag_crash.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -# This program tests for a bug which crashed pspp when using LAG - -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$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 / - 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 << EOF -DATA LIST LIST /x. -BEGIN DATA -1 -2 -END DATA. - -DO IF (x <> LAG(x) ). - ECHO 'hello'. -END IF. - -EXECUTE. -EOF -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run_program" -$SUPERVISOR $PSPP -o pspp.csv $TESTFILE -if [ $? -ne 0 ] ; then fail ; fi - - -pass; diff --git a/tests/command/lag.sh b/tests/command/lag.sh deleted file mode 100755 index 06d85883..00000000 --- a/tests/command/lag.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh - -# This program tests the LAG function - -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$EXEEXT - -# 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 > $TEMPDIR/lag.stat < LAG(x) ). + ECHO 'hello'. +END IF. + +EXECUTE. +]) +AT_CHECK([pspp -o pspp.csv lag.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Table: Reading free-form data from INLINE. +Variable,Format +x,F8.0 + +hello +]) +AT_CLEANUP -- 2.30.2