mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Convert the existing regression test scripts for the various optional
PLs to use the standard pg_regress infrastructure. No changes in the tests themselves. Andrew Dunstan
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Makefile for PL/Perl
|
||||
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.18 2004/11/19 19:22:58 tgl Exp $
|
||||
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.19 2005/05/14 17:55:20 tgl Exp $
|
||||
|
||||
subdir = src/pl/plperl
|
||||
top_builddir = ../../..
|
||||
@@ -36,6 +36,8 @@ OBJS = plperl.o spi_internal.o SPI.o
|
||||
|
||||
SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)
|
||||
|
||||
REGRESS = plperl
|
||||
|
||||
include $(top_srcdir)/src/Makefile.shlib
|
||||
|
||||
|
||||
@@ -59,8 +61,17 @@ installdirs:
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)
|
||||
|
||||
installcheck: submake
|
||||
$(SHELL) $(top_builddir)/src/test/regress/pg_regress --load-language=plperl $(REGRESS)
|
||||
|
||||
.PHONY: submake
|
||||
submake:
|
||||
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress
|
||||
|
||||
clean distclean maintainer-clean: clean-lib
|
||||
rm -f SPI.c $(OBJS)
|
||||
rm -rf results
|
||||
rm -f regression.diffs regression.out
|
||||
|
||||
else # can't build
|
||||
|
||||
|
@@ -1,4 +1,11 @@
|
||||
--
|
||||
-- checkpoint so that if we have a crash in the tests, replay of the
|
||||
-- just-completed CREATE DATABASE won't discard the core dump file
|
||||
--
|
||||
checkpoint;
|
||||
--
|
||||
-- Test result value processing
|
||||
--
|
||||
CREATE OR REPLACE FUNCTION perl_int(int) RETURNS INTEGER AS $$
|
||||
return undef;
|
||||
$$ LANGUAGE plperl;
|
||||
@@ -277,6 +284,9 @@ SELECT (perl_out_params_set()).f3;
|
||||
PL/Perl
|
||||
(3 rows)
|
||||
|
||||
--
|
||||
-- Check behavior with erroneous return values
|
||||
--
|
||||
CREATE TYPE footype AS (x INTEGER, y INTEGER);
|
||||
CREATE OR REPLACE FUNCTION foo_good() RETURNS SETOF footype AS $$
|
||||
return [
|
||||
@@ -334,6 +344,9 @@ return [
|
||||
$$ LANGUAGE plperl;
|
||||
SELECT * FROM foo_set_bad();
|
||||
ERROR: Perl hash contains nonexistent column "z"
|
||||
--
|
||||
-- Check passing a tuple argument
|
||||
--
|
||||
CREATE OR REPLACE FUNCTION perl_get_field(footype, text) RETURNS integer AS $$
|
||||
return $_[0]->{$_[1]};
|
||||
$$ LANGUAGE plperl;
|
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
DBNAME=plperl_test
|
||||
export DBNAME
|
||||
|
||||
echo "**** Destroy old database $DBNAME ****"
|
||||
dropdb $DBNAME
|
||||
|
||||
sleep 1
|
||||
|
||||
echo "**** Create test database $DBNAME ****"
|
||||
createdb $DBNAME || exit 1
|
||||
|
||||
echo "**** Create procedural language plperl ****"
|
||||
createlang plperl $DBNAME || exit 1
|
||||
|
||||
echo "**** Running test queries ****"
|
||||
psql -q -n -e $DBNAME <test_queries.sql > test.out 2>&1
|
||||
|
||||
if diff test.expected test.out >/dev/null 2>&1 ; then
|
||||
echo " Tests passed O.K."
|
||||
rm test.out
|
||||
else
|
||||
echo " Tests failed - look at diffs between"
|
||||
echo " test.expected and test.out"
|
||||
fi
|
Reference in New Issue
Block a user