summaryrefslogtreecommitdiffstats
path: root/src/test/locale/koi8-r/runall
blob: 5f420d666b8439f9510c7094f2e588bc0183017c (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
#! /bin/sh

PATH=..:$PATH

echo "Testing PostgreSQL compilation..."

LC_CTYPE=ru_RU.KOI8-R
LC_COLLATE=$LC_CTYPE
export LC_CTYPE LC_COLLATE

echo "Testing LC_CTYPE..."
if ! test-ctype > koi8-ctype.out; then
   exit 1
fi
diff expected/koi8-ctype.out koi8-ctype.out

echo "Testing LC_COLLATE..."
perl ../sort-test.pl test-koi8-sort.in > test-koi8-sort.out
diff expected/test-koi8-sort.out test-koi8-sort.out

### If you have Python - uncomment the following two lines
#python ../sort-test.py test-koi8-sort.in > test-koi8-sort.out
#diff expected/test-koi8-sort.out test-koi8-sort.out


abort() {
   [ "$1" ] && echo "$*"
   exit 1
}

for f in char varchar text; do
   if echo $f | grep -q char; then
      ftype="$f(60)"
   else
      ftype="$f"
   fi
   echo "Testing PgSQL: sort on $ftype type..."

   dropdb testlocale >/dev/null 2>&1
   createdb testlocale || abort "createdb failed"
   psql -X -d testlocale -c "CREATE TABLE usastates (abbrev char(2), name_en char(20), name_ru $ftype);"  >/dev/null 2>&1 || abort "createtable failed"
   psql -X testlocale < test-koi8.sql.in > test-koi8-$f.sql.out 2>/dev/null || abort "test query failed"
   diff expected/test-koi8-$f.sql.out test-koi8-$f.sql.out
done
echo "Testing PgSQL: select on regexp..."
psql -X testlocale < test-koi8-select.sql.in > test-koi8-select.sql.out 2>/dev/null || abort "select query failed"
diff expected/test-koi8-select.sql.out test-koi8-select.sql.out
dropdb testlocale || abort "dropdb failed"
echo "Finished."