#!/bin/sh # $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.40 2000/02/13 21:45:15 petere Exp $ # if [ $# -eq 0 ] then echo "Syntax: $0 [extra-tests]" exit 1 fi hostname=$1 shift extratests="$*" if [ "x$hostname" = "xwin" -o "x$hostname" = "xqnx4" ] then HOSTLOC="-h localhost" else HOSTLOC="" fi if echo '\c' | grep -s c >/dev/null 2>&1 then ECHO_N="echo -n" ECHO_C="" else ECHO_N="echo" ECHO_C='\c' fi PGTZ="PST8PDT"; export PGTZ PGDATESTYLE="Postgres,US"; export PGDATESTYLE FRONTEND="psql $HOSTLOC -a -q" # ---------- # Scan resultmap file to find which platform-specific expected files to use. # The format of each line of the file is # testname/hostnamepattern=substitutefile # where the hostnamepattern is evaluated per the rules of expr(1) --- namely, # it is a standard regular expression with an implicit ^ at the start. # ---------- SUBSTLIST="" exec 4 results/${tst}.out 2>&1 # # Check list extracted from resultmap to see if we should compare # to a system-specific expected file. # There shouldn't be multiple matches, but take the last if there are. # EXPECTED="expected/${tst}.out" for LINE in $SUBSTLIST do if [ `expr "$LINE" : "$tst/"` -ne 0 ] then SUBST=`echo "$LINE" | sed 's/^.*=//'` EXPECTED="expected/${SUBST}.out" fi done if [ `diff ${DIFFOPT} ${EXPECTED} results/${tst}.out | wc -l` -ne 0 ] then ( diff ${DIFFOPT} -C3 ${EXPECTED} results/${tst}.out; \ echo ""; \ echo "----------------------"; \ echo "" ) >> regression.diffs echo failed else echo ok fi done exit 0 echo "=============== running error queries ... =================" $FRONTEND regression < errors.sql # this will generate error result code #set this to 1 to avoid clearing the database debug=0 if test "$debug" -eq 1 then echo Skipping clearing and deletion of the regression database else echo "=============== clearing regression database... =================" $FRONTEND regression < drop.sql if [ $? -ne 0 ]; then echo the drop script has an error exit 1 fi exit 0 echo "=============== dropping regression database... =================" dropdb regression if [ $? -ne 0 ]; then echo dropdb failed exit 1 fi exit 0 fi