2 # $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.44 2000/03/14 23:06:55 thomas Exp $
5 echo "Syntax: $0 <hostname> [extra-tests]"
13 if [ "x$hostname" = "xwin" -o "x$hostname" = "xi386-pc-qnx4" ]; then
14 HOSTLOC="-h localhost"
19 if echo '\c' | grep -s c >/dev/null 2>&1
28 PGTZ="PST8PDT"; export PGTZ
29 PGDATESTYLE="Postgres,US"; export PGDATESTYLE
31 FRONTEND="psql $HOSTLOC -a -q -X"
34 # Scan resultmap file to find which platform-specific expected files to use.
35 # The format of each line of the file is
36 # testname/hostnamepattern=substitutefile
37 # where the hostnamepattern is evaluated per the rules of expr(1) --- namely,
38 # it is a standard regular expression with an implicit ^ at the start.
41 RESULTMAP=`cat resultmap`
42 for LINE in $RESULTMAP
44 HOSTPAT=`expr "$LINE" : '.*/\(.*\)='`
45 if [ `expr "$hostname" : "$HOSTPAT"` -ne 0 ]
47 SUBSTLIST="$SUBSTLIST $LINE"
55 echo "=============== Notes... ================="
56 echo "postmaster must already be running for the regression tests to succeed."
57 echo "The time zone is set to PST8PDT for these tests by the client frontend."
58 echo "Please report any apparent problems to ports@postgresql.org"
59 echo "See regress/README for more information."
62 echo "=============== dropping old regression database... ================="
63 dropdb $HOSTLOC regression
65 echo "=============== creating new regression database... ================="
66 if [ -n "$MULTIBYTE" ];then
67 mbtests=`echo $MULTIBYTE | tr "[A-Z]" "[a-z]"`
68 PGCLIENTENCODING="$MULTIBYTE"
69 export PGCLIENTENCODING
70 ENCODINGOPT="-E $MULTIBYTE"
73 unset PGCLIENTENCODING
76 createdb $ENCODINGOPT $HOSTLOC regression
82 if [ "x$hostname" != "xi386-pc-qnx4" ]; then
83 echo "=============== installing languages... ================="
84 $ECHO_N "installing PL/pgSQL .. " $ECHO_C
85 createlang $HOSTLOC plpgsql regression
86 if [ $? -ne 0 -a $? -ne 2 ]; then
94 echo "=============== running regression queries... ================="
95 echo "" > regression.diffs
97 if [ "x$hostname" = "xi386-pc-qnx4" ]; then
104 $1=="test" { print $2; }
106 ' < sql/run_check.tests`
108 for tst in $stdtests $mbtests $extratests
110 $ECHO_N "${tst} .. " $ECHO_C
111 $FRONTEND regression < sql/${tst}.sql > results/${tst}.out 2>&1
114 # Check list extracted from resultmap to see if we should compare
115 # to a system-specific expected file.
116 # There shouldn't be multiple matches, but take the last if there are.
118 EXPECTED="expected/${tst}.out"
119 for LINE in $SUBSTLIST
121 if [ `expr "$LINE" : "$tst/"` -ne 0 ]
123 SUBST=`echo "$LINE" | sed 's/^.*=//'`
124 EXPECTED="expected/${SUBST}.out"
128 if [ `diff ${DIFFOPT} ${EXPECTED} results/${tst}.out | wc -l` -ne 0 ]; then
129 ( diff ${DIFFOPT} -C3 ${EXPECTED} results/${tst}.out; \
131 echo "----------------------"; \
132 echo "" ) >> regression.diffs
141 echo "=============== running error queries ... ================="
142 $FRONTEND regression < errors.sql
143 # this will generate error result code
145 #set this to 1 to avoid clearing the database
148 if [ test "$debug" -eq 1 ]; then
149 echo Skipping clearing and deletion of the regression database
151 echo "=============== clearing regression database... ================="
152 $FRONTEND regression < drop.sql
153 if [ $? -ne 0 ]; then
154 echo the drop script has an error
159 echo "=============== dropping regression database... ================="
161 if [ $? -ne 0 ]; then