|
| 1 | +#! /bin/sh |
| 2 | + |
| 3 | +PATH=..:$PATH |
| 4 | + |
| 5 | +echo "Testing PostgreSQL compilation..." |
| 6 | +if ! test-pgsql-locale; then |
| 7 | + exit 1 |
| 8 | +fi |
| 9 | + |
| 10 | +LC_CTYPE=gr_GR.ISO8859-7 |
| 11 | +LC_COLLATE=$LC_CTYPE |
| 12 | +export LC_CTYPE LC_COLLATE |
| 13 | + |
| 14 | +echo "Testing LC_CTYPE..." |
| 15 | +if ! test-ctype > gr-ctype.out; then |
| 16 | + exit 1 |
| 17 | +fi |
| 18 | +diff expected/gr-ctype.out gr-ctype.out |
| 19 | + |
| 20 | +echo "Testing LC_COLLATE..." |
| 21 | +perl ../sort-test.pl test-gr-sort.in > test-gr-sort.out |
| 22 | +diff expected/test-gr-sort.out test-gr-sort.out |
| 23 | + |
| 24 | +### If you have Python - uncomment the following two lines |
| 25 | +#python ../sort-test.py test-gr-sort.in > test-gr-sort.out |
| 26 | +#diff expected/test-gr-sort.out test-gr-sort.out |
| 27 | + |
| 28 | + |
| 29 | +abort() { |
| 30 | + [ "$1" ] && echo "$*" |
| 31 | + exit 1 |
| 32 | +} |
| 33 | + |
| 34 | +for f in char varchar text; do |
| 35 | + if echo $f | grep -q char; then |
| 36 | + ftype="$f(60)" |
| 37 | + else |
| 38 | + ftype="$f" |
| 39 | + fi |
| 40 | + echo "Testing PgSQL: sort on $ftype type..." |
| 41 | + |
| 42 | + destroydb testlocale >/dev/null 2>&1 |
| 43 | + createdb testlocale || abort "createdb failed" |
| 44 | + psql -d testlocale -c "CREATE TABLE usastates (abbrev char(2), name_en char(20), name_gr $ftype);" >/dev/null 2>&1 || abort "createtable failed" |
| 45 | + psql testlocale < test-gr.sql.in > test-gr-$f.sql.out 2>/dev/null || abort "test query failed" |
| 46 | + diff expected/test-gr-$f.sql.out test-gr-$f.sql.out |
| 47 | +done |
| 48 | +echo "Testing PgSQL: select on regexp..." |
| 49 | +psql testlocale < test-gr-select.sql.in > test-gr-select.sql.out 2>/dev/null || abort "select query failed" |
| 50 | +diff expected/test-gr-select.sql.out test-gr-select.sql.out |
| 51 | +destroydb testlocale || abort "destroydb failed" |
| 52 | +echo "Finished." |
0 commit comments