X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fcommand%2Fget-data-psql.sh;h=fa61d6d684db5ee9ea1060ad6f6dd69cc31f2666;hb=6ba6662c69e868290d1e514ffe65ef447e9263d6;hp=507144ceb41a39f5e260b109cbffad892e327032;hpb=8b03aa29f34fde020febc38fa1119bf99bc55205;p=pspp-builds.git diff --git a/tests/command/get-data-psql.sh b/tests/command/get-data-psql.sh index 507144ce..fa61d6d6 100755 --- a/tests/command/get-data-psql.sh +++ b/tests/command/get-data-psql.sh @@ -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 --testing-mode -o raw-ascii $TESTFILE +if [ $? -ne 0 ] ; then no_result ; fi + +activity="compare output 3" +perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list +diff -b $TEMPDIR/pspp.list - << 'EOF' + x diff +-------- -------- + 1.00 . + 2.00 1.00 + 3.00 1.00 + 4.00 1.00 + 5.00 1.00 + 6.00 1.00 + 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 + pass;