From: Ben Pfaff <blp@cs.stanford.edu>
Date: Wed, 13 Oct 2010 03:49:15 +0000 (-0700)
Subject: data-out: Convert tests for binary and hex formats to Autotest framework.
X-Git-Tag: v0.7.6~28
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc4cd1371a6aa4b74901998c046f76801b5a85b1;p=pspp-builds.git

data-out: Convert tests for binary and hex formats to Autotest framework.
---

diff --git a/tests/automake.mk b/tests/automake.mk
index 70ff67cc..53dcdf0a 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/formats/binhex-out.sh \
 	tests/formats/date-in.sh \
 	tests/formats/date-out.sh \
 	tests/formats/float-format.sh \
@@ -262,6 +261,7 @@ EXTRA_DIST += \
 TESTSUITE_AT = \
 	tests/data/calendar.at \
 	tests/data/data-in.at \
+	tests/data/data-out.at \
 	tests/data/datasheet-test.at \
 	tests/data/por-file.at \
 	tests/data/sys-file.at \
diff --git a/tests/data/binhex-out.expected.gz b/tests/data/binhex-out.expected.gz
new file mode 100644
index 00000000..f8fc6e98
Binary files /dev/null and b/tests/data/binhex-out.expected.gz differ
diff --git a/tests/data/data-out.at b/tests/data/data-out.at
new file mode 100644
index 00000000..95f60d59
--- /dev/null
+++ b/tests/data/data-out.at
@@ -0,0 +1,119 @@
+AT_BANNER([data output (data-out)])
+
+AT_SETUP([binary and hexadecimal output])
+AT_DATA([binhex-out.sps], [dnl
+SET ERRORS=NONE.
+SET MXWARNS=10000000.
+SET WIB=MSBFIRST.
+DATA LIST NOTABLE/x 1-10.
+BEGIN DATA.
+
+2
+11
+123
+1234
+913
+3.14159
+777
+82
+690
+-2
+-11
+-123
+-1234
+-913
+-3.14159
+-777
+-82
+-690
+-.1
+-.5
+-.9
+9999.1
+9999.5
+9999.9
+10000
+18231237
+-9999.1
+-9999.5
+-9999.9
+-10000
+-8231237
+999.1
+999.5
+999.9
+1000
+8231237
+-999.1
+-999.5
+-999.9
+-1000
+-8231237
+99.1
+99.5
+99.9
+100
+821237
+-99.1
+-99.5
+-99.9
+-100
+-831237
+9.1
+9.5
+9.9
+10
+81237
+-9.1
+-9.5
+-9.9
+-10
+-81237
+1.1
+-1.1
+1.5
+-1.5
+1.9
+-1.9
+END DATA.
+FILE HANDLE output/NAME='binhex.out'/MODE=IMAGE/LRECL=256.
+WRITE OUTFILE=output/
+	x(p1.0) x(p2.0) x(p3.0) x(p4.0)		/* 000
+	x(p2.1) x(p3.1) x(p4.1)			/* 00a
+	x(p3.2) x(p4.2)				/* 013
+	x(p4.3)					/* 01a
+	x(pk1.0) x(pk2.0) x(pk3.0) x(pk4.0)	/* 01e
+	x(pk2.1) x(pk3.1) x(pk4.1)		/* 028
+	x(pk3.2) x(pk4.2)			/* 031
+	x(pk4.3)				/* 038
+	x(ib1.0) x(ib2.0) x(ib3.0) x(ib4.0)	/* 03c
+	x(ib1.1) x(ib2.1) x(ib3.1) x(ib4.1)	/* 046
+	x(ib1.2) x(ib2.2) x(ib3.2) x(ib4.2)	/* 050
+	x(ib1.3) x(ib2.3) x(ib3.3) x(ib4.3)	/* 05a
+	x(ib2.4) x(ib3.4) x(ib4.4)		/* 064
+	x(ib2.5) x(ib3.5) x(ib4.5)		/* 06d
+	x(ib3.6) x(ib4.6)			/* 076
+	x(ib3.7) x(ib4.7)			/* 07d
+	x(ib3.8) x(ib4.8)			/* 084
+	x(ib4.9)				/* 08b
+	x(ib4.10)				/* 08f
+	x(pib1.0) x(pib2.0) x(pib3.0) x(pib4.0)	/* 093
+	x(pib1.1) x(pib2.1) x(pib3.1) x(pib4.1)	/* 09d
+	x(pib1.2) x(pib2.2) x(pib3.2) x(pib4.2)	/* 0a7
+	x(pib1.3) x(pib2.3) x(pib3.3) x(pib4.3)	/* 0b1
+	x(pib2.4) x(pib3.4) x(pib4.4)		/* 0bb
+	x(pib2.5) x(pib3.5) x(pib4.5)		/* 0c4
+	x(pib3.6) x(pib4.6)			/* 0cd
+	x(pib3.7) x(pib4.7)			/* 0d4
+	x(pib3.8) x(pib4.8)			/* 0db
+	x(pib4.9)				/* 0e2
+	x(pib4.10)				/* 0e6
+	x(pibhex2) x(pibhex4)			/* 0ea
+        x(pibhex6) x(pibhex8).			/* 0f0
+						/* 0fe
+EXECUTE.
+])
+AT_CHECK([pspp -O format=csv binhex-out.sps])
+AT_CHECK([gzip -cd < $top_srcdir/tests/data/binhex-out.expected.gz > expout])
+AT_CHECK([cat binhex.out], [0], [expout])
+AT_CLEANUP
diff --git a/tests/formats/binhex-out.expected.gz b/tests/formats/binhex-out.expected.gz
deleted file mode 100644
index f8fc6e98..00000000
Binary files a/tests/formats/binhex-out.expected.gz and /dev/null differ
diff --git a/tests/formats/binhex-out.sh b/tests/formats/binhex-out.sh
deleted file mode 100755
index 04e0cdc0..00000000
--- a/tests/formats/binhex-out.sh
+++ /dev/null
@@ -1,168 +0,0 @@
-#! /bin/sh
-
-TEMPDIR=/tmp/pspp-tst-$$
-mkdir -p $TEMPDIR
-trap 'cd /; rm -rf $TEMPDIR' 0
-
-# 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
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    exit 2;
-}
-
-pass()
-{
-    exit 0;
-}
-
-cd $TEMPDIR
-
-activity="write pspp syntax"
-cat > binhex-out.pspp <<EOF
-set errors=none.
-set mxwarns=10000000.
-set wib=msbfirst.
-data list /x 1-10.
-begin data.
-
-2
-11
-123
-1234
-913
-3.14159
-777
-82
-690
--2
--11
--123
--1234
--913
--3.14159
--777
--82
--690
--.1
--.5
--.9
-9999.1
-9999.5
-9999.9
-10000
-18231237
--9999.1
--9999.5
--9999.9
--10000
--8231237
-999.1
-999.5
-999.9
-1000
-8231237
--999.1
--999.5
--999.9
--1000
--8231237
-99.1
-99.5
-99.9
-100
-821237
--99.1
--99.5
--99.9
--100
--831237
-9.1
-9.5
-9.9
-10
-81237
--9.1
--9.5
--9.9
--10
--81237
-1.1
--1.1
-1.5
--1.5
-1.9
--1.9
-end data.
-file handle output/name='binhex.out'/mode=image/lrecl=256.
-write outfile=output/
-	x(p1.0) x(p2.0) x(p3.0) x(p4.0)		/* 000
-	x(p2.1) x(p3.1) x(p4.1)			/* 00a
-	x(p3.2) x(p4.2)				/* 013
-	x(p4.3)					/* 01a
-	x(pk1.0) x(pk2.0) x(pk3.0) x(pk4.0)	/* 01e
-	x(pk2.1) x(pk3.1) x(pk4.1)		/* 028
-	x(pk3.2) x(pk4.2)			/* 031
-	x(pk4.3)				/* 038
-	x(ib1.0) x(ib2.0) x(ib3.0) x(ib4.0)	/* 03c
-	x(ib1.1) x(ib2.1) x(ib3.1) x(ib4.1)	/* 046
-	x(ib1.2) x(ib2.2) x(ib3.2) x(ib4.2)	/* 050
-	x(ib1.3) x(ib2.3) x(ib3.3) x(ib4.3)	/* 05a
-	x(ib2.4) x(ib3.4) x(ib4.4)		/* 064
-	x(ib2.5) x(ib3.5) x(ib4.5)		/* 06d
-	x(ib3.6) x(ib4.6)			/* 076
-	x(ib3.7) x(ib4.7)			/* 07d
-	x(ib3.8) x(ib4.8)			/* 084
-	x(ib4.9)				/* 08b
-	x(ib4.10)				/* 08f
-	x(pib1.0) x(pib2.0) x(pib3.0) x(pib4.0)	/* 093
-	x(pib1.1) x(pib2.1) x(pib3.1) x(pib4.1)	/* 09d
-	x(pib1.2) x(pib2.2) x(pib3.2) x(pib4.2)	/* 0a7
-	x(pib1.3) x(pib2.3) x(pib3.3) x(pib4.3)	/* 0b1
-	x(pib2.4) x(pib3.4) x(pib4.4)		/* 0bb
-	x(pib2.5) x(pib3.5) x(pib4.5)		/* 0c4
-	x(pib3.6) x(pib4.6)			/* 0cd
-	x(pib3.7) x(pib4.7)			/* 0d4
-	x(pib3.8) x(pib4.8)			/* 0db
-	x(pib4.9)				/* 0e2
-	x(pib4.10)				/* 0e6
-	x(pibhex2) x(pibhex4)			/* 0ea
-        x(pibhex6) x(pibhex8).			/* 0f0
-						/* 0fe
-execute.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv binhex-out.pspp
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="gunzip expected results"
-gzip -cd < $top_srcdir/tests/formats/binhex-out.expected.gz > expected.out
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare output"
-cmp expected.out binhex.out
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass