From: Ben Pfaff Date: Thu, 14 Oct 2010 01:32:39 +0000 (-0700) Subject: data-in: Convert tests for N and Z formats to Autotest framework. X-Git-Tag: v0.7.6~16 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=493527639c58bd78c7951260b32a6dcfc68abaee;p=pspp-builds.git data-in: Convert tests for N and Z formats to Autotest framework. --- diff --git a/tests/automake.mk b/tests/automake.mk index 7cafde45..bb229d31 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -12,7 +12,6 @@ TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT) dist_TESTS = \ tests/formats/date-in.sh \ tests/formats/ib-in.sh \ - tests/formats/legacy-in.sh \ tests/formats/month-in.sh \ tests/formats/num-in.sh \ tests/formats/num-out.sh \ @@ -218,10 +217,10 @@ EXTRA_DIST += \ tests/coverage.sh tests/test_template \ tests/data/bcd-in.expected.cmp.gz \ tests/data/binhex-out.expected.gz \ + tests/data/legacy-in.expected.cmp.gz \ tests/data/v13.sav \ tests/data/v14.sav \ tests/formats/ib-in.expected.cmp.gz \ - tests/formats/legacy-in.expected.cmp.gz \ tests/formats/num-in.expected.gz \ tests/formats/num-out.expected.cmp.gz \ tests/formats/num-out-cmp.pl \ diff --git a/tests/data/data-in.at b/tests/data/data-in.at index f3c1fde9..77827b0b 100644 --- a/tests/data/data-in.at +++ b/tests/data/data-in.at @@ -101,3 +101,23 @@ AT_CHECK([gzip -cd < $top_srcdir/tests/data/bcd-in.expected.cmp.gz | \ AT_CHECK([pspp -O format=csv bcd-in.sps]) AT_CHECK([cat bcd-in.out], [0], [expout]) AT_CLEANUP + +AT_SETUP([legacy input (N and Z formats)]) +AT_CHECK([$PERL -e 'print pack "n", $_ foreach 0...65535' > legacy-in.data]) +AT_CHECK([wc -c < legacy-in.data], [0], [131072 +]) +AT_DATA([legacy-in.sps], [dnl +SET ERRORS=NONE. +SET MXWARNS=10000000. +SET MXERRS=10000000. +FILE HANDLE data/NAME='legacy-in.data'/MODE=IMAGE/LRECL=2. +DATA LIST NOTABLE FILE=data/n 1-2 (N) z 1-2 (z). +COMPUTE x=$CASENUM - 1. +PRINT OUTFILE='legacy-in.out'/x (PIBHEX4) ' ' N Z. +EXECUTE. +]) +AT_CHECK([gzip -cd < $top_srcdir/tests/data/legacy-in.expected.cmp.gz | \ + $PERL -pe "printf ' %04X ', $.-1" > expout]) +AT_CHECK([pspp -O format=csv legacy-in.sps]) +AT_CHECK([cat legacy-in.out], [0], [expout]) +AT_CLEANUP diff --git a/tests/data/legacy-in.expected.cmp.gz b/tests/data/legacy-in.expected.cmp.gz new file mode 100644 index 00000000..952f9b58 Binary files /dev/null and b/tests/data/legacy-in.expected.cmp.gz differ diff --git a/tests/formats/legacy-in.expected.cmp.gz b/tests/formats/legacy-in.expected.cmp.gz deleted file mode 100644 index 952f9b58..00000000 Binary files a/tests/formats/legacy-in.expected.cmp.gz and /dev/null differ diff --git a/tests/formats/legacy-in.sh b/tests/formats/legacy-in.sh deleted file mode 100755 index bdf41c51..00000000 --- a/tests/formats/legacy-in.sh +++ /dev/null @@ -1,89 +0,0 @@ -#! /bin/sh - -TEMPDIR=/tmp/pspp-tst-$$ - -# 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 -: ${PERL:=perl} - -# 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="generate data input file" -$PERL -e 'print pack "n", $_ foreach 0...65535' > legacy-in.data - -activity="write pspp syntax" -cat > legacy-in.pspp <<'EOF' -SET ERRORS=NONE. -SET MXWARNS=10000000. -SET MXERRS=10000000. -FILE HANDLE data/NAME='legacy-in.data'/MODE=IMAGE/LRECL=2. -DATA LIST FILE=data/n 1-2 (N) z 1-2 (z). -COMPUTE x=$CASENUM - 1. -PRINT OUTFILE='legacy-in.out'/x (PIBHEX4) ' ' N Z. -EXECUTE. -EOF -if [ $? -ne 0 ] ; then no_result ; fi - -activity="run program" -$SUPERVISOR $PSPP -o pspp.csv legacy-in.pspp -if [ $? -ne 0 ] ; then no_result ; fi - -activity="gunzip expected results" -gzip -cd < $top_srcdir/tests/formats/legacy-in.expected.cmp.gz > legacy-in.expected.cmp -if [ $? -ne 0 ] ; then no_result ; fi - -activity="decompress expected results" -$PERL -pe "printf ' %04X ', $.-1" < legacy-in.expected.cmp > legacy-in.expected -if [ $? -ne 0 ] ; then no_result ; fi - -activity="compare output" -diff -u legacy-in.expected legacy-in.out -if [ $? -ne 0 ] ; then fail ; fi - -pass