X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fcommand%2Fget-data-psql.sh;h=c71d23a515f31ec081e97c2cf0daab103bd49274;hb=d01cc07b11b5919369bf4e8989360c2b4fe0380c;hp=507144ceb41a39f5e260b109cbffad892e327032;hpb=8b03aa29f34fde020febc38fa1119bf99bc55205;p=pspp diff --git a/tests/command/get-data-psql.sh b/tests/command/get-data-psql.sh index 507144ceb4..c71d23a515 100755 --- a/tests/command/get-data-psql.sh +++ b/tests/command/get-data-psql.sh @@ -11,7 +11,7 @@ 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 +PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT STAT_CONFIG_PATH=$top_srcdir/config export STAT_CONFIG_PATH @@ -21,8 +21,8 @@ export LANG port=6543 dbase=pspptest -PG_CONFIG=pg_config -pgpath=`$PG_CONFIG | awk '/BINDIR/{print $3}'` +PG_CONFIG=${PG_CONFIG:=pg_config} +pgpath=`$PG_CONFIG --bindir` cleanup() { @@ -30,7 +30,8 @@ cleanup() echo "NOT cleaning $TEMPDIR" return ; fi - PGHOST=$TEMPDIR $pgpath/pg_ctl -D $TEMPDIR/cluster stop -w -o "-k $TEMPDIR -h ''" > /dev/null 2>&1 + PGHOST=$TEMPDIR $pgpath/pg_ctl -D $TEMPDIR/cluster stop -W -o "-k $TEMPDIR -h ''" > /dev/null 2>&1 + cd / rm -rf $TEMPDIR } @@ -72,18 +73,26 @@ activity="create cluster" $pgpath/initdb -D $TEMPDIR/cluster -A trust > /dev/null if [ $? -ne 0 ] ; then no_result ; fi - activity="run server" -PGHOST=$TEMPDIR $pgpath/pg_ctl -D $TEMPDIR/cluster start -w -o "-k $TEMPDIR -p $port -h ''" > /dev/null +PGHOST=$TEMPDIR PGPORT=$port $pgpath/pg_ctl -D $TEMPDIR/cluster start -w -o "-k $TEMPDIR -h ''" > /dev/null if [ $? -ne 0 ] ; then no_result ; fi activity="create database" -createdb -h $TEMPDIR -p $port $dbase > /dev/null 2> /dev/null +$pgpath/createdb -h $TEMPDIR -p $port $dbase > /dev/null 2> /dev/null +if [ $? -ne 0 ] ; then no_result ; fi activity="populate database" -psql -h $TEMPDIR -p $port $dbase > /dev/null << EOF +$pgpath/psql -h $TEMPDIR -p $port $dbase > /dev/null << EOF + +CREATE TABLE empty (a int, b date, c numeric(23, 4)); + +-- a largeish table to check big queries work ok. +CREATE TABLE large (x int); +INSERT INTO large (select * from generate_series(1, 1000)); + + CREATE TABLE thing ( bool bool , bytea bytea , @@ -178,7 +187,7 @@ INSERT INTO thing VALUES ( EOF if [ $? -ne 0 ] ; then fail ; fi -activity="create program" +activity="create program 1" cat > $TESTFILE < $TESTFILE < $TESTFILE < 1). +LIST. + +TEMPORARY. +N OF CASES 6. +LIST. + +SORT CASES BY x (D). + +TEMPORARY. +N OF CASES 6. +LIST. + +EOF +if [ $? -ne 0 ] ; then no_result ; fi + +activity="run program 3" +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE +if [ $? -ne 0 ] ; then no_result ; fi + +activity="compare output 3" +diff -c $TEMPDIR/pspp.csv - << 'EOF' +Table: Data List +x,diff +1.00,. +2.00,1.00 +3.00,1.00 +4.00,1.00 +5.00,1.00 +6.00,1.00 + +Table: Data List +x,diff +1000.00,1.00 +999.00,1.00 +998.00,1.00 +997.00,1.00 +996.00,1.00 +995.00,1.00 +EOF +if [ $? -ne 0 ] ; then fail ; fi + + + +# Check for a bug caused by having string variables in the database, +# all of which are null. + +activity="populate database 4" +$pgpath/psql -h $TEMPDIR -p $port $dbase > /dev/null << EOF + +-- a table which has a text field containing only null, or zero +-- length entries. + +CREATE TABLE foo (int4 int4, text text); + +INSERT INTO foo VALUES ('12', ''); + +INSERT INTO foo VALUES (null, ''); + +EOF +if [ $? -ne 0 ] ; then fail ; fi + + +activity="create program 4" +cat > $TESTFILE <