Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0ff7a2c

Browse files
committed
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
1 parent 1ea069b commit 0ff7a2c

30 files changed

+859
-176
lines changed

src/pl/Makefile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/pl/Makefile,v 1.22 2003/11/29 19:52:12 pgsql Exp $
7+
# $PostgreSQL: pgsql/src/pl/Makefile,v 1.23 2005/05/14 17:55:20 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,10 +14,6 @@ include $(top_builddir)/src/Makefile.global
1414

1515
DIRS := plpgsql
1616

17-
ifeq ($(with_tcl), yes)
18-
DIRS += tcl
19-
endif
20-
2117
ifeq ($(with_perl), yes)
2218
DIRS += plperl
2319
endif
@@ -26,8 +22,22 @@ ifeq ($(with_python), yes)
2622
DIRS += plpython
2723
endif
2824

25+
ifeq ($(with_tcl), yes)
26+
DIRS += tcl
27+
endif
28+
2929
all install installdirs uninstall depend distprep:
30-
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
30+
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit 1; done
3131

3232
clean distclean maintainer-clean:
3333
@for dir in $(DIRS); do $(MAKE) -C $$dir $@; done
34+
35+
# We'd like check operations to run all the subtests before failing;
36+
# also insert a sleep to ensure the previous test backend exited before
37+
# we try to drop the regression database.
38+
check installcheck:
39+
@CHECKERR=0; for dir in $(DIRS); do \
40+
sleep 1; \
41+
$(MAKE) -C $$dir $@ || CHECKERR=$$?; \
42+
done; \
43+
exit $$CHECKERR

src/pl/plperl/GNUmakefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Makefile for PL/Perl
2-
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.18 2004/11/19 19:22:58 tgl Exp $
2+
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.19 2005/05/14 17:55:20 tgl Exp $
33

44
subdir = src/pl/plperl
55
top_builddir = ../../..
@@ -36,6 +36,8 @@ OBJS = plperl.o spi_internal.o SPI.o
3636

3737
SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)
3838

39+
REGRESS = plperl
40+
3941
include $(top_srcdir)/src/Makefile.shlib
4042

4143

@@ -59,8 +61,17 @@ installdirs:
5961
uninstall:
6062
rm -f $(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)
6163

64+
installcheck: submake
65+
$(SHELL) $(top_builddir)/src/test/regress/pg_regress --load-language=plperl $(REGRESS)
66+
67+
.PHONY: submake
68+
submake:
69+
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress
70+
6271
clean distclean maintainer-clean: clean-lib
6372
rm -f SPI.c $(OBJS)
73+
rm -rf results
74+
rm -f regression.diffs regression.out
6475

6576
else # can't build
6677

src/pl/plperl/test/test.expected renamed to src/pl/plperl/expected/plperl.out

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
--
2+
-- checkpoint so that if we have a crash in the tests, replay of the
3+
-- just-completed CREATE DATABASE won't discard the core dump file
4+
--
15
checkpoint;
6+
--
7+
-- Test result value processing
8+
--
29
CREATE OR REPLACE FUNCTION perl_int(int) RETURNS INTEGER AS $$
310
return undef;
411
$$ LANGUAGE plperl;
@@ -277,6 +284,9 @@ SELECT (perl_out_params_set()).f3;
277284
PL/Perl
278285
(3 rows)
279286

287+
--
288+
-- Check behavior with erroneous return values
289+
--
280290
CREATE TYPE footype AS (x INTEGER, y INTEGER);
281291
CREATE OR REPLACE FUNCTION foo_good() RETURNS SETOF footype AS $$
282292
return [
@@ -334,6 +344,9 @@ return [
334344
$$ LANGUAGE plperl;
335345
SELECT * FROM foo_set_bad();
336346
ERROR: Perl hash contains nonexistent column "z"
347+
--
348+
-- Check passing a tuple argument
349+
--
337350
CREATE OR REPLACE FUNCTION perl_get_field(footype, text) RETURNS integer AS $$
338351
return $_[0]->{$_[1]};
339352
$$ LANGUAGE plperl;
File renamed without changes.

src/pl/plperl/test/runtest

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/pl/plpython/Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.18 2004/11/19 19:23:01 tgl Exp $
1+
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.19 2005/05/14 17:55:21 tgl Exp $
22

33
subdir = src/pl/plpython
44
top_builddir = ../../..
@@ -58,6 +58,8 @@ endif
5858

5959
SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec) $(python_additional_libs)
6060

61+
REGRESS = plpython_schema plpython_populate plpython_function plpython_test plpython_error plpython_drop
62+
6163
include $(top_srcdir)/src/Makefile.shlib
6264

6365

@@ -78,16 +80,21 @@ installdirs:
7880
uninstall:
7981
rm -f $(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)
8082

83+
installcheck: submake
84+
$(SHELL) $(top_builddir)/src/test/regress/pg_regress --load-language=plpythonu $(REGRESS)
85+
86+
.PHONY: submake
87+
submake:
88+
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress
89+
8190
clean distclean maintainer-clean: clean-lib
8291
rm -f $(OBJS)
83-
@rm -f error.diff feature.diff error.output feature.output test.log
92+
rm -rf results
93+
rm -f regression.diffs regression.out
8494
ifeq ($(PORTNAME), win32)
8595
rm -f python${pytverstr}.def
8696
endif
8797

88-
installcheck:
89-
PATH=$(bindir):$$PATH $(SHELL) $(srcdir)/test.sh
90-
9198
else # can't build
9299

93100
all:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--
2+
-- For paranoia's sake, don't leave an untrusted language sitting around
3+
--
4+
SET client_min_messages = WARNING;
5+
DROP PROCEDURAL LANGUAGE plpythonu CASCADE;

src/pl/plpython/error.expected renamed to src/pl/plpython/expected/plpython_error.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
-- test error handling, i forgot to restore Warn_restart in
2+
-- the trigger handler once. the errors and subsequent core dump were
3+
-- interesting.
14
SELECT invalid_type_uncaught('rick');
25
WARNING: plpython: in function invalid_type_uncaught:
36
DETAIL: plpy.SPIError: Unknown error in PLy_spi_prepare
@@ -16,6 +19,7 @@ SELECT valid_type('rick');
1619

1720
(1 row)
1821

22+
-- Security sandbox tests
1923
SELECT write_file('/tmp/plpython','Only trusted users should be able to do this!');
2024
write_file
2125
------------------------------

0 commit comments

Comments
 (0)