Debian Codegraph @

src/test/mb/mbregress.sh

raw
1 #! /bin/sh
2 # src/test/mb/mbregress.sh
3
4 if echo '\c' | grep -s c >/dev/null 2>&1
5 then
6 ECHO_N="echo -n"
7 ECHO_C=""
8 else
9 ECHO_N="echo"
10 ECHO_C='\c'
11 fi
12
13 if [ ! -d results ];then
14 mkdir results
15 fi
16
17 dropdb --if-exists utf8
18 createdb -T template0 -l C -E UTF8 utf8 || exit 1
19
20 PSQL="psql -X -n -e -q"
21
22 # in the test list, client-only encodings must follow the server encoding
23 # they're to be tested with; see hard-coded cases below
24 tests="euc_jp sjis euc_kr euc_cn euc_tw big5 utf8 gb18030 mule_internal"
25
26 EXITCODE=0
27
28 unset PGCLIENTENCODING
29 for i in $tests
30 do
31 $ECHO_N "${i} .. " $ECHO_C
32
33 if [ $i = sjis ];then
34 PGCLIENTENCODING=SJIS
35 export PGCLIENTENCODING
36 $PSQL euc_jp < sql/sjis.sql > results/sjis.out 2>&1
37 unset PGCLIENTENCODING
38 elif [ $i = big5 ];then
39 PGCLIENTENCODING=BIG5
40 export PGCLIENTENCODING
41 $PSQL euc_tw < sql/big5.sql > results/big5.out 2>&1
42 unset PGCLIENTENCODING
43 elif [ $i = gb18030 ];then
44 PGCLIENTENCODING=GB18030
45 export PGCLIENTENCODING
46 $PSQL utf8 < sql/gb18030.sql > results/gb18030.out 2>&1
47 unset PGCLIENTENCODING
48 else
49 dropdb $i >/dev/null 2>&1
50 createdb -T template0 -l C -E `echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` $i >/dev/null
51 $PSQL $i < sql/${i}.sql > results/${i}.out 2>&1
52 fi
53
54 if [ -f expected/${i}-${SYSTEM}.out ]
55 then
56 EXPECTED="expected/${i}-${SYSTEM}.out"
57 else
58 EXPECTED="expected/${i}.out"
59 fi
60
61 if [ `diff ${EXPECTED} results/${i}.out | wc -l` -ne 0 ]
62 then
63 ( diff -C3 ${EXPECTED} results/${i}.out; \
64 echo ""; \
65 echo "----------------------"; \
66 echo "" ) >> regression.diffs
67 echo failed
68 EXITCODE=1
69 else
70 echo ok
71 fi
72 done
73
74 exit $EXITCODE