blob: b717f34dfb9d355031fe3bc4f0f366c0bd8e53ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
#!/bin/sh
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.42 2000/03/01 19:11:06 momjian Exp $
#
if [ $# -eq 0 ]
then
echo "Syntax: $0 <hostname> [extra-tests]"
exit 1
fi
hostname=$1
shift
extratests="$*"
if [ "x$hostname" = "xwin" -o "x$hostname" = "xi386-pc-qnx4" ]
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=""
RESULTMAP=`cat resultmap`
for LINE in $RESULTMAP
do
HOSTPAT=`expr "$LINE" : '.*/\(.*\)='`
if [ `expr "$hostname" : "$HOSTPAT"` -ne 0 ]
then
SUBSTLIST="$SUBSTLIST $LINE"
fi
done
if [ -d ./obj ]; then
cd ./obj
fi
echo "=============== Notes... ================="
echo "postmaster must already be running for the regression tests to succeed."
echo "The time zone is set to PST8PDT for these tests by the client frontend."
echo "Please report any apparent problems to ports@postgresql.org"
echo "See regress/README for more information."
echo ""
echo "=============== dropping old regression database... ================="
dropdb $HOSTLOC regression
echo "=============== creating new regression database... ================="
if [ -n "$MULTIBYTE" ];then
mbtests=`echo $MULTIBYTE | tr "[A-Z]" "[a-z]"`
PGCLIENTENCODING="$MULTIBYTE"
export PGCLIENTENCODING
ENCODINGOPT="-E $MULTIBYTE"
else
mbtests=""
unset PGCLIENTENCODING
ENCODINGOPT=""
fi
createdb $ENCODINGOPT $HOSTLOC regression
if [ $? -ne 0 ]; then
echo createdb failed
exit 1
fi
if [ "x$hostname" != "xi386-pc-qnx4" ]
then
echo "=============== installing PL/pgSQL... ================="
createlang $HOSTLOC plpgsql regression
if [ $? -ne 0 -a $? -ne 2 ]; then
echo createlang failed
exit 1
fi
fi
echo "=============== running regression queries... ================="
echo "" > regression.diffs
if [ "x$hostname" = "xi386-pc-qnx4" ]
then
DIFFOPT="-b"
else
DIFFOPT="-w"
fi
stdtests=`awk '
$1=="test" { print $2; }
{}
' < sql/run_check.tests`
for tst in $stdtests $mbtests $extratests
do
$ECHO_N "${tst} .. " $ECHO_C
$FRONTEND regression < sql/${tst}.sql > 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
|