From 736af120ae00b122994e9e023a29c43ad722a46e Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 3 Oct 2010 15:45:44 -0700 Subject: [PATCH] Convert PRINT and WRITE tests to Autotest framework. --- tests/automake.mk | 4 +- tests/bugs/print-crash.sh | 77 ----------- tests/command/print-strings.sh | 93 ------------- tests/command/print.sh | 215 ------------------------------ tests/language/data-io/print.at | 225 ++++++++++++++++++++++++++++++++ 5 files changed, 226 insertions(+), 388 deletions(-) delete mode 100755 tests/bugs/print-crash.sh delete mode 100755 tests/command/print-strings.sh delete mode 100755 tests/command/print.sh create mode 100644 tests/language/data-io/print.at diff --git a/tests/automake.mk b/tests/automake.mk index 14b1194c..28776cf1 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -10,8 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT) dist_TESTS = \ - tests/command/print.sh \ - tests/command/print-strings.sh \ tests/command/rank.sh \ tests/command/rename.sh \ tests/command/regression.sh \ @@ -87,7 +85,6 @@ dist_TESTS = \ tests/bugs/unwritable-dir.sh \ tests/bugs/val-labs.sh \ tests/bugs/val-labs-trailing-slash.sh \ - tests/bugs/print-crash.sh \ tests/bugs/keep-all.sh \ tests/data/datasheet-test.sh \ tests/libpspp/sparse-xarray-test.sh \ @@ -363,6 +360,7 @@ TESTSUITE_AT = \ tests/language/data-io/get-data-txt.at \ tests/language/data-io/list.at \ tests/language/data-io/match-files.at \ + tests/language/data-io/print.at \ tests/language/data-io/save.at \ tests/language/data-io/save-translate.at \ tests/language/dictionary/attributes.at \ diff --git a/tests/bugs/print-crash.sh b/tests/bugs/print-crash.sh deleted file mode 100755 index 7995e042..00000000 --- a/tests/bugs/print-crash.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh - -# This program tests for a bug which crashed when deallocating after a bad -# PRINT command. - -TEMPDIR=/tmp/pspp-tst-$$ -TESTFILE=$TEMPDIR/`basename $0`.sps - -# ensure that top_srcdir and top_builddir are absolute -if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi -if [ -z "$top_builddir" ] ; then top_builddir=. ; fi -top_srcdir=`cd $top_srcdir; pwd` -top_builddir=`cd $top_builddir; pwd` - -PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT - -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 - -cat > $TESTFILE << EOF -DATA LIST LIST /a * b *. -BEGIN DATA. -1 2 -3 4 -END DATA. - -PRINT F8.2 -LIST. -EOF -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run program" -$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE -if [ $? -ne 1 ] ; then fail ; fi - - -pass; diff --git a/tests/command/print-strings.sh b/tests/command/print-strings.sh deleted file mode 100755 index b6a1ba9b..00000000 --- a/tests/command/print-strings.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh - -# This program tests that the PRINT command properly outputs string variables. - -TEMPDIR=/tmp/pspp-tst-$$ -TESTFILE=$TEMPDIR/`basename $0`.sps - -# ensure that top_srcdir and top_builddir are absolute -if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi -if [ -z "$top_builddir" ] ; then top_builddir=. ; fi -top_srcdir=`cd $top_srcdir; pwd` -top_builddir=`cd $top_builddir; pwd` -PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT - -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 > $TESTFILE < $TEMPDIR/print.stat << foobar -data list notable /x y 1-2. -begin data. -12 -34 - 6 -7 -90 -end data. - -print /x y. -print eject /x y 1-2. -print /x '-' y. -print. - -print outfile='print.out' /x y. -print eject outfile='print.out' /x y (f1,f1). -print outfile='print.out' /x '-' y. -print outfile='print.out'. - -write outfile='write.out' /x y. -write outfile='write.out' /x y (2(f1)). -write outfile='write.out' /x '-' y. -write outfile='write.out'. - -execute. -foobar -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run program" -$SUPERVISOR $PSPP -o pspp.csv --error-file=$TEMPDIR/errs $TEMPDIR/print.stat -if [ $? -ne 0 ] ; then fail ; fi - -activity="compare print.out" -diff -b $TEMPDIR/print.out - <