From: Ben Pfaff Date: Sun, 26 Sep 2010 02:46:35 +0000 (-0700) Subject: tests: Convert FILE HANDLE tests to use Autotest. X-Git-Tag: v0.7.6~154 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ad9184a196bc3554623144812dd1d60fe780c57;p=pspp-builds.git tests: Convert FILE HANDLE tests to use Autotest. --- diff --git a/tests/automake.mk b/tests/automake.mk index f601a695..61e75489 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/file-handle.sh \ tests/command/filter.sh \ tests/command/get-data-txt.sh \ tests/command/get-data-txt-examples.sh \ @@ -387,6 +386,7 @@ TESTSUITE_AT = \ tests/language/data-io/add-files.at \ tests/language/data-io/data-list.at \ tests/language/data-io/data-reader.at \ + tests/language/data-io/file-handle.at \ tests/language/data-io/save.at \ tests/language/data-io/save-translate.at \ tests/language/dictionary/attributes.at \ diff --git a/tests/command/file-handle.sh b/tests/command/file-handle.sh deleted file mode 100755 index f63b50a8..00000000 --- a/tests/command/file-handle.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh - -# This program's primary purpose is to test the FILE HANDLE command - -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 file" -cat > $TEMPDIR/wiggle.txt << EOF -1 -2 -5 -109 -EOF -if [ $? -ne 0 ] ; then no_result ; fi - - - -activity="create program" -cat > $TESTFILE << EOF -FILE HANDLE myhandle /NAME='$TEMPDIR/wiggle.txt'. -DATA LIST LIST FILE=myhandle /x *. -LIST. -EOF -if [ $? -ne 0 ] ; then no_result ; fi - -activity="run program" -$SUPERVISOR $PSPP -o pspp.csv $TESTFILE -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="compare output" -diff -c $TEMPDIR/pspp.csv - << EOF -Table: Reading free-form data from myhandle. -Variable,Format -x,F8.0 - -Table: Data List -x -1.00 -2.00 -5.00 -109.00 -EOF -if [ $? -ne 0 ] ; then fail ; fi - - -pass; diff --git a/tests/language/data-io/file-handle.at b/tests/language/data-io/file-handle.at new file mode 100644 index 00000000..add22d20 --- /dev/null +++ b/tests/language/data-io/file-handle.at @@ -0,0 +1,28 @@ +AT_BANNER([FILE HANDLE]) + +AT_SETUP([FILE HANDLE]) +AT_DATA([wiggle.txt], [dnl +1 +2 +5 +109 +]) +AT_DATA([file-handle.sps], [dnl +FILE HANDLE myhandle /NAME='wiggle.txt'. +DATA LIST LIST FILE=myhandle /x *. +LIST. +]) +AT_CHECK([pspp -O format=csv file-handle.sps], [0], [dnl +Table: Reading free-form data from myhandle. +Variable,Format +x,F8.0 + +Table: Data List +x +1.00 +2.00 +5.00 +109.00 +]) +AT_CLEANUP +