mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 00:08:31 -05:00
test isn't that complete up to now, but I think it shows
enough of the capabilities of the module.
The Makefile assumes it is located in a directory under
pgsql/src/pl. Since it includes Makefile.global and
Makefile.port and doesn't use any own compiler/linker calls,
it should build on most of our supported platforms (I only
tested under Linux up to now). It requires flex and bison I
think. Maybe we should ship prepared gram.c etc. like for the
main parser too?
Jan
50 lines
1007 B
Bash
Executable File
50 lines
1007 B
Bash
Executable File
#!/bin/sh
|
|
|
|
DB=plpgsql_test
|
|
export DB
|
|
|
|
FRONTEND="psql -n -e -q"
|
|
export FRONTEND
|
|
|
|
echo "*** destroy old $DB database ***"
|
|
destroydb $DB
|
|
|
|
echo "*** create new $DB database ***"
|
|
createdb $DB
|
|
|
|
echo "*** install PL/pgSQL ***"
|
|
$FRONTEND -f mklang.sql -d $DB >/dev/null 2>&1
|
|
|
|
echo "*** create tables ***"
|
|
$FRONTEND -f tables.sql -d $DB >output/tables.out 2>&1
|
|
if cmp -s output/tables.out expected/tables.out ; then
|
|
echo "OK"
|
|
else
|
|
echo "FAILED"
|
|
fi
|
|
|
|
echo "*** create triggers ***"
|
|
$FRONTEND -f triggers.sql -d $DB >output/triggers.out 2>&1
|
|
if cmp -s output/triggers.out expected/triggers.out ; then
|
|
echo "OK"
|
|
else
|
|
echo "FAILED"
|
|
fi
|
|
|
|
echo "*** create views and support functions ***"
|
|
$FRONTEND -f views.sql -d $DB >output/views.out 2>&1
|
|
if cmp -s output/views.out expected/views.out ; then
|
|
echo "OK"
|
|
else
|
|
echo "FAILED"
|
|
fi
|
|
|
|
echo "*** running tests ***"
|
|
$FRONTEND -f test.sql -d $DB >output/test.out 2>&1
|
|
if cmp -s output/test.out expected/test.out ; then
|
|
echo "OK"
|
|
else
|
|
echo "FAILED"
|
|
fi
|
|
|