Make regression tests work with VPATH builds.

This commit is contained in:
Peter Eisentraut 2000-10-27 20:00:22 +00:00
parent 29f6c8dff8
commit 7e77668e7a
11 changed files with 119 additions and 91 deletions

View File

@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.29 2000/10/23 21:44:07 petere Exp $
# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.30 2000/10/27 20:00:19 petere Exp $
#
#-------------------------------------------------------------------------
@ -60,11 +60,36 @@ output_files := $(foreach file, $(file_list), expected/$(file).out)
all: $(input_files) $(output_files)
sql/%.sql: input/%.source
pwd=`pwd` && sed "s,_OBJWD_,$$pwd,g;s/_DLSUFFIX_/$(DLSUFFIX)/g" $(srcdir)/$< >$@
abs_srcdir := $(shell cd $(srcdir) && pwd)
abs_builddir := $(shell pwd)
expected/%.out: output/%.source
pwd=`pwd` && sed "s,_OBJWD_,$$pwd,g;s/_DLSUFFIX_/$(DLSUFFIX)/g" $(srcdir)/$< >$@
define sed-command
sed -e 's,@abs_srcdir@,$(abs_srcdir),g' \
-e 's,@abs_builddir@,$(abs_builddir),g' \
-e 's/@DLSUFFIX@/$(DLSUFFIX)/g' $< >$@
endef
$(input_files): sql/%.sql: input/%.source
$(sed-command)
$(output_files): expected/%.out: output/%.source
$(sed-command)
# When doing a VPATH build, copy over the remaining .sql and .out
# files so that the driver script can find them. We have to use an
# absolute path for the targets, because otherwise make will try to
# locate the missing files using VPATH, and will find them in
# $(srcdir), but the point here is that we want to copy them from
# $(srcdir) to the build directory.
ifdef VPATH
remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out)
remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))
all: $(remaining_files_build)
$(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
ln -s $< $@
endif
# And finally some extra C modules...
@ -81,10 +106,10 @@ all-spi:
##
check: all
$(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=parallel_schedule --multibyte=$(MULTIBYTE)
$(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE)
installcheck: all
$(SHELL) ./pg_regress --schedule=serial_schedule --multibyte=$(MULTIBYTE)
$(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE)
# old interfaces follow...
@ -173,3 +198,6 @@ clean distclean maintainer-clean:
ifeq ($(PORTNAME), win)
rm -f regress.def
endif
ifdef VPATH
rm -f $(remaining_files_build)
endif

View File

@ -189,11 +189,11 @@ CREATE TABLE COPY_TBL (x INT, y TEXT, z INT,
CONSTRAINT COPY_CON
CHECK (x > 3 AND y <> 'check failed' AND x < 7 ));
COPY COPY_TBL FROM '_OBJWD_/data/constro.data';
COPY COPY_TBL FROM '@abs_srcdir@/data/constro.data';
SELECT '' AS two, * FROM COPY_TBL;
COPY COPY_TBL FROM '_OBJWD_/data/constrf.data';
COPY COPY_TBL FROM '@abs_srcdir@/data/constrf.data';
SELECT * FROM COPY_TBL;

View File

@ -5,52 +5,52 @@
-- CLASS POPULATION
-- (any resemblance to real life is purely coincidental)
--
COPY aggtest FROM '_OBJWD_/data/agg.data';
COPY aggtest FROM '@abs_srcdir@/data/agg.data';
COPY onek FROM '_OBJWD_/data/onek.data';
COPY onek FROM '@abs_srcdir@/data/onek.data';
COPY onek TO '_OBJWD_/results/onek.data';
COPY onek TO '@abs_builddir@/results/onek.data';
DELETE FROM onek;
COPY onek FROM '_OBJWD_/results/onek.data';
COPY onek FROM '@abs_builddir@/results/onek.data';
COPY tenk1 FROM '_OBJWD_/data/tenk.data';
COPY tenk1 FROM '@abs_srcdir@/data/tenk.data';
COPY slow_emp4000 FROM '_OBJWD_/data/rect.data';
COPY slow_emp4000 FROM '@abs_srcdir@/data/rect.data';
COPY person FROM '_OBJWD_/data/person.data';
COPY person FROM '@abs_srcdir@/data/person.data';
COPY emp FROM '_OBJWD_/data/emp.data';
COPY emp FROM '@abs_srcdir@/data/emp.data';
COPY student FROM '_OBJWD_/data/student.data';
COPY student FROM '@abs_srcdir@/data/student.data';
COPY stud_emp FROM '_OBJWD_/data/stud_emp.data';
COPY stud_emp FROM '@abs_srcdir@/data/stud_emp.data';
COPY road FROM '_OBJWD_/data/streets.data';
COPY road FROM '@abs_srcdir@/data/streets.data';
COPY real_city FROM '_OBJWD_/data/real_city.data';
COPY real_city FROM '@abs_srcdir@/data/real_city.data';
COPY hash_i4_heap FROM '_OBJWD_/data/hash.data';
COPY hash_i4_heap FROM '@abs_srcdir@/data/hash.data';
COPY hash_name_heap FROM '_OBJWD_/data/hash.data';
COPY hash_name_heap FROM '@abs_srcdir@/data/hash.data';
COPY hash_txt_heap FROM '_OBJWD_/data/hash.data';
COPY hash_txt_heap FROM '@abs_srcdir@/data/hash.data';
COPY hash_f8_heap FROM '_OBJWD_/data/hash.data';
COPY hash_f8_heap FROM '@abs_srcdir@/data/hash.data';
-- the data in this file has a lot of duplicates in the index key
-- fields, leading to long bucket chains and lots of table expansion.
-- this is therefore a stress test of the bucket overflow code (unlike
-- the data in hash.data, which has unique index keys).
--
-- COPY hash_ovfl_heap FROM '_OBJWD_/data/hashovfl.data';
-- COPY hash_ovfl_heap FROM '@abs_srcdir@/data/hashovfl.data';
COPY bt_i4_heap FROM '_OBJWD_/data/desc.data';
COPY bt_i4_heap FROM '@abs_srcdir@/data/desc.data';
COPY bt_name_heap FROM '_OBJWD_/data/hash.data';
COPY bt_name_heap FROM '@abs_srcdir@/data/hash.data';
COPY bt_txt_heap FROM '_OBJWD_/data/desc.data';
COPY bt_txt_heap FROM '@abs_srcdir@/data/desc.data';
COPY bt_f8_heap FROM '_OBJWD_/data/hash.data';
COPY bt_f8_heap FROM '@abs_srcdir@/data/hash.data';

View File

@ -4,41 +4,41 @@
CREATE FUNCTION widget_in(opaque)
RETURNS widget
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'c';
CREATE FUNCTION widget_out(opaque)
RETURNS opaque
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'c';
CREATE FUNCTION check_primary_key ()
RETURNS opaque
AS '_OBJWD_/../../../contrib/spi/refint_DLSUFFIX_'
AS '@abs_builddir@/../../../contrib/spi/refint@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION check_foreign_key ()
RETURNS opaque
AS '_OBJWD_/../../../contrib/spi/refint_DLSUFFIX_'
AS '@abs_builddir@/../../../contrib/spi/refint@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION autoinc ()
RETURNS opaque
AS '_OBJWD_/../../../contrib/spi/autoinc_DLSUFFIX_'
AS '@abs_builddir@/../../../contrib/spi/autoinc@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION funny_dup17 ()
RETURNS opaque
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION ttdummy ()
RETURNS opaque
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION set_ttdummy (int4)
RETURNS int4
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';

View File

@ -29,31 +29,31 @@ CREATE FUNCTION user_relns()
CREATE FUNCTION pt_in_widget(point, widget)
RETURNS bool
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION overpaid(emp)
RETURNS bool
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION boxarea(box)
RETURNS float8
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION interpt_pp(path, path)
RETURNS point
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION reverse_name(name)
RETURNS name
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'c';
--
-- Function dynamic loading
--
LOAD '_OBJWD_/regress_DLSUFFIX_';
LOAD '@abs_builddir@/regress@DLSUFFIX@';

View File

@ -49,25 +49,25 @@ DROP TABLE tmp;
--
-- copy
--
COPY onek TO '_OBJWD_/results/onek.data';
COPY onek TO '@abs_builddir@/results/onek.data';
DELETE FROM onek;
COPY onek FROM '_OBJWD_/results/onek.data';
COPY onek FROM '@abs_builddir@/results/onek.data';
SELECT unique1 FROM onek WHERE unique1 < 2;
DELETE FROM onek2;
COPY onek2 FROM '_OBJWD_/results/onek.data';
COPY onek2 FROM '@abs_builddir@/results/onek.data';
SELECT unique1 FROM onek2 WHERE unique1 < 2;
COPY BINARY stud_emp TO '_OBJWD_/results/stud_emp.data';
COPY BINARY stud_emp TO '@abs_builddir@/results/stud_emp.data';
DELETE FROM stud_emp;
COPY BINARY stud_emp FROM '_OBJWD_/results/stud_emp.data';
COPY BINARY stud_emp FROM '@abs_builddir@/results/stud_emp.data';
SELECT * FROM stud_emp;

View File

@ -265,7 +265,7 @@ SELECT * FROM INSERT_TBL;
CREATE TABLE COPY_TBL (x INT, y TEXT, z INT,
CONSTRAINT COPY_CON
CHECK (x > 3 AND y <> 'check failed' AND x < 7 ));
COPY COPY_TBL FROM '_OBJWD_/data/constro.data';
COPY COPY_TBL FROM '@abs_srcdir@/data/constro.data';
SELECT '' AS two, * FROM COPY_TBL;
two | x | y | z
-----+---+---------------+---
@ -273,7 +273,7 @@ SELECT '' AS two, * FROM COPY_TBL;
| 6 | OK | 4
(2 rows)
COPY COPY_TBL FROM '_OBJWD_/data/constrf.data';
COPY COPY_TBL FROM '@abs_srcdir@/data/constrf.data';
ERROR: copy: line 2, CopyFrom: rejected due to CHECK constraint copy_con
SELECT * FROM COPY_TBL;
x | y | z

View File

@ -4,30 +4,30 @@
-- CLASS POPULATION
-- (any resemblance to real life is purely coincidental)
--
COPY aggtest FROM '_OBJWD_/data/agg.data';
COPY onek FROM '_OBJWD_/data/onek.data';
COPY onek TO '_OBJWD_/results/onek.data';
COPY aggtest FROM '@abs_srcdir@/data/agg.data';
COPY onek FROM '@abs_srcdir@/data/onek.data';
COPY onek TO '@abs_builddir@/results/onek.data';
DELETE FROM onek;
COPY onek FROM '_OBJWD_/results/onek.data';
COPY tenk1 FROM '_OBJWD_/data/tenk.data';
COPY slow_emp4000 FROM '_OBJWD_/data/rect.data';
COPY person FROM '_OBJWD_/data/person.data';
COPY emp FROM '_OBJWD_/data/emp.data';
COPY student FROM '_OBJWD_/data/student.data';
COPY stud_emp FROM '_OBJWD_/data/stud_emp.data';
COPY road FROM '_OBJWD_/data/streets.data';
COPY real_city FROM '_OBJWD_/data/real_city.data';
COPY hash_i4_heap FROM '_OBJWD_/data/hash.data';
COPY hash_name_heap FROM '_OBJWD_/data/hash.data';
COPY hash_txt_heap FROM '_OBJWD_/data/hash.data';
COPY hash_f8_heap FROM '_OBJWD_/data/hash.data';
COPY onek FROM '@abs_builddir@/results/onek.data';
COPY tenk1 FROM '@abs_srcdir@/data/tenk.data';
COPY slow_emp4000 FROM '@abs_srcdir@/data/rect.data';
COPY person FROM '@abs_srcdir@/data/person.data';
COPY emp FROM '@abs_srcdir@/data/emp.data';
COPY student FROM '@abs_srcdir@/data/student.data';
COPY stud_emp FROM '@abs_srcdir@/data/stud_emp.data';
COPY road FROM '@abs_srcdir@/data/streets.data';
COPY real_city FROM '@abs_srcdir@/data/real_city.data';
COPY hash_i4_heap FROM '@abs_srcdir@/data/hash.data';
COPY hash_name_heap FROM '@abs_srcdir@/data/hash.data';
COPY hash_txt_heap FROM '@abs_srcdir@/data/hash.data';
COPY hash_f8_heap FROM '@abs_srcdir@/data/hash.data';
-- the data in this file has a lot of duplicates in the index key
-- fields, leading to long bucket chains and lots of table expansion.
-- this is therefore a stress test of the bucket overflow code (unlike
-- the data in hash.data, which has unique index keys).
--
-- COPY hash_ovfl_heap FROM '_OBJWD_/data/hashovfl.data';
COPY bt_i4_heap FROM '_OBJWD_/data/desc.data';
COPY bt_name_heap FROM '_OBJWD_/data/hash.data';
COPY bt_txt_heap FROM '_OBJWD_/data/desc.data';
COPY bt_f8_heap FROM '_OBJWD_/data/hash.data';
-- COPY hash_ovfl_heap FROM '@abs_srcdir@/data/hashovfl.data';
COPY bt_i4_heap FROM '@abs_srcdir@/data/desc.data';
COPY bt_name_heap FROM '@abs_srcdir@/data/hash.data';
COPY bt_txt_heap FROM '@abs_srcdir@/data/desc.data';
COPY bt_f8_heap FROM '@abs_srcdir@/data/hash.data';

View File

@ -3,34 +3,34 @@
--
CREATE FUNCTION widget_in(opaque)
RETURNS widget
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'c';
NOTICE: ProcedureCreate: type 'widget' is not yet defined
CREATE FUNCTION widget_out(opaque)
RETURNS opaque
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'c';
CREATE FUNCTION check_primary_key ()
RETURNS opaque
AS '_OBJWD_/../../../contrib/spi/refint_DLSUFFIX_'
AS '@abs_builddir@/../../../contrib/spi/refint@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION check_foreign_key ()
RETURNS opaque
AS '_OBJWD_/../../../contrib/spi/refint_DLSUFFIX_'
AS '@abs_builddir@/../../../contrib/spi/refint@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION autoinc ()
RETURNS opaque
AS '_OBJWD_/../../../contrib/spi/autoinc_DLSUFFIX_'
AS '@abs_builddir@/../../../contrib/spi/autoinc@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION funny_dup17 ()
RETURNS opaque
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION ttdummy ()
RETURNS opaque
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION set_ttdummy (int4)
RETURNS int4
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';

View File

@ -22,25 +22,25 @@ CREATE FUNCTION user_relns()
LANGUAGE 'sql';
CREATE FUNCTION pt_in_widget(point, widget)
RETURNS bool
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION overpaid(emp)
RETURNS bool
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION boxarea(box)
RETURNS float8
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION interpt_pp(path, path)
RETURNS point
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'newC';
CREATE FUNCTION reverse_name(name)
RETURNS name
AS '_OBJWD_/regress_DLSUFFIX_'
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'c';
--
-- Function dynamic loading
--
LOAD '_OBJWD_/regress_DLSUFFIX_';
LOAD '@abs_builddir@/regress@DLSUFFIX@';

View File

@ -39,9 +39,9 @@ DROP TABLE tmp;
--
-- copy
--
COPY onek TO '_OBJWD_/results/onek.data';
COPY onek TO '@abs_builddir@/results/onek.data';
DELETE FROM onek;
COPY onek FROM '_OBJWD_/results/onek.data';
COPY onek FROM '@abs_builddir@/results/onek.data';
SELECT unique1 FROM onek WHERE unique1 < 2;
unique1
---------
@ -50,7 +50,7 @@ SELECT unique1 FROM onek WHERE unique1 < 2;
(2 rows)
DELETE FROM onek2;
COPY onek2 FROM '_OBJWD_/results/onek.data';
COPY onek2 FROM '@abs_builddir@/results/onek.data';
SELECT unique1 FROM onek2 WHERE unique1 < 2;
unique1
---------
@ -58,9 +58,9 @@ SELECT unique1 FROM onek2 WHERE unique1 < 2;
1
(2 rows)
COPY BINARY stud_emp TO '_OBJWD_/results/stud_emp.data';
COPY BINARY stud_emp TO '@abs_builddir@/results/stud_emp.data';
DELETE FROM stud_emp;
COPY BINARY stud_emp FROM '_OBJWD_/results/stud_emp.data';
COPY BINARY stud_emp FROM '@abs_builddir@/results/stud_emp.data';
SELECT * FROM stud_emp;
name | age | location | salary | manager | gpa | percent
-------+-----+------------+--------+---------+-----+---------