From: Ben Pfaff Date: Sun, 10 Oct 2010 21:09:06 +0000 (-0700) Subject: tests: Convert test for #! support to Autotest framework. X-Git-Tag: v0.7.6~56 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48ad6229d048c132839eb10b7b21b364e0d26817;p=pspp-builds.git tests: Convert test for #! support to Autotest framework. --- diff --git a/tests/automake.mk b/tests/automake.mk index fc6a2cb0..90b76d9b 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -27,7 +27,6 @@ dist_TESTS = \ tests/formats/wkday-in.sh \ tests/formats/wkday-out.sh \ tests/formats/360.sh \ - tests/bugs/shbang.sh \ tests/bugs/signals.sh \ tests/bugs/temporary.sh \ tests/bugs/unwritable-dir.sh \ @@ -325,6 +324,7 @@ TESTSUITE_AT = \ tests/language/dictionary/weight.at \ tests/language/expressions/evaluate.at \ tests/language/expressions/parse.at \ + tests/language/lexer/lexer.at \ tests/language/lexer/q2c.at \ tests/language/lexer/variable-parser.at \ tests/language/stats/aggregate.at \ diff --git a/tests/bugs/shbang.sh b/tests/bugs/shbang.sh deleted file mode 100755 index 607e4a77..00000000 --- a/tests/bugs/shbang.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh - -# This program tests that PSPP ignores the first line of a PSPP syntax -# file that begins with #!, without issuing an error (bug #26518). - -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 -#! $PSPP -DATA LIST LIST NOTABLE /a. -BEGIN DATA. -1 -2 -END DATA. -LIST. -EOF -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run program" -$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE -if [ $? -ne 0 ] ; then fail ; fi - - -activity="compare output" -perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.csv -diff -b -w $TEMPDIR/pspp.csv - << EOF -Table: Data List -a -1.00 -2.00 -EOF -if [ $? -ne 0 ] ; then fail ; fi - - -pass; diff --git a/tests/language/lexer/lexer.at b/tests/language/lexer/lexer.at new file mode 100644 index 00000000..2c1dfc93 --- /dev/null +++ b/tests/language/lexer/lexer.at @@ -0,0 +1,20 @@ +AT_BANNER([lexer]) + +AT_SETUP([lexer ignores initial @%:@! line]) +AT_DATA([lexer.sps], [dnl +#! /usr/local/bin/pspp +DATA LIST LIST NOTABLE /a. +BEGIN DATA. +1 +2 +END DATA. +LIST. +]) +AT_CHECK([pspp -o pspp.csv lexer.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Table: Data List +a +1.00 +2.00 +]) +AT_CLEANUP