aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GNUmakefile.in6
-rw-r--r--src/Makefile.global.in9
-rw-r--r--src/backend/storage/ipc/Makefile6
-rw-r--r--src/backend/utils/adt/Makefile6
-rw-r--r--src/bin/scripts/createlang.sh5
-rw-r--r--src/template/linux1
-rw-r--r--src/test/Makefile5
-rw-r--r--src/test/regress/GNUmakefile144
-rw-r--r--src/test/regress/expected/Makefile17
-rw-r--r--src/test/regress/input/Makefile39
-rw-r--r--src/test/regress/output/Makefile40
-rw-r--r--src/test/regress/parallel_schedule75
-rw-r--r--src/test/regress/pg_regress.sh570
-rwxr-xr-xsrc/test/regress/regress.sh4
-rwxr-xr-xsrc/test/regress/run_check.sh3
-rw-r--r--src/test/regress/serial_schedule74
-rw-r--r--src/test/regress/sql/Makefile17
17 files changed, 831 insertions, 190 deletions
diff --git a/src/GNUmakefile.in b/src/GNUmakefile.in
index 98e46999c6f..30322c22bad 100644
--- a/src/GNUmakefile.in
+++ b/src/GNUmakefile.in
@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/Attic/GNUmakefile.in,v 1.59 2000/07/23 13:01:08 petere Exp $
+# $Header: /cvsroot/pgsql/src/Attic/GNUmakefile.in,v 1.60 2000/09/29 17:17:32 petere Exp $
#
#-------------------------------------------------------------------------
@@ -27,7 +27,7 @@ clean:
$(MAKE) -C bin $@
$(MAKE) -C pl $@
$(MAKE) -C utils $@
- $(MAKE) -C test clean
+ $(MAKE) -C test $@
distclean maintainer-clean:
-$(MAKE) -C utils $@
@@ -36,5 +36,5 @@ distclean maintainer-clean:
-$(MAKE) -C interfaces $@
-$(MAKE) -C bin $@
-$(MAKE) -C pl $@
- -$(MAKE) -C test clean
+ -$(MAKE) -C test $@
rm -f Makefile.port Makefile.global GNUmakefile
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index a6298e6407e..f075931c038 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -1,4 +1,4 @@
-# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.96 2000/09/27 15:17:54 petere Exp $
+# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.97 2000/09/29 17:17:32 petere Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -162,7 +162,10 @@ endif
# Name of the target platform.
PORTNAME= @PORTNAME@
-CPU= @CPU@
+
+host_tuple = @host@
+host_os = @host_os@
+host_cpu = @host_cpu@
# Various grungy items needed to configure some platforms.
HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
@@ -239,7 +242,7 @@ STRERROR2 = @STRERROR2@
SNPRINTF = @SNPRINTF@
STRDUP = @STRDUP@
-.PHONY: all install installdirs uninstall dep depend clean distclean maintainer-clean distprep
+.PHONY: all install installdirs uninstall dep depend clean distclean maintainer-clean distprep check installcheck
.SILENT: installdirs
# make `all' the default target
diff --git a/src/backend/storage/ipc/Makefile b/src/backend/storage/ipc/Makefile
index 22ee0feaad5..51b3ed5c46c 100644
--- a/src/backend/storage/ipc/Makefile
+++ b/src/backend/storage/ipc/Makefile
@@ -1,7 +1,7 @@
#
# Makefile for storage/ipc
#
-# $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.13 2000/08/31 16:10:33 petere Exp $
+# $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.14 2000/09/29 17:17:33 petere Exp $
#
subdir = src/backend/storage/ipc
@@ -9,8 +9,8 @@ top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
# seems to be required 1999/07/22 bjm
-ifeq ($(CPU), alpha)
-ifeq ($(GCC), yes)
+ifeq "$(findstring alpha,$(host_cpu))" "alpha"
+ifeq "$(GCC)" "yes"
CFLAGS+= -fno-inline
endif
endif
diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefile
index 40e70c19cc7..1504430477a 100644
--- a/src/backend/utils/adt/Makefile
+++ b/src/backend/utils/adt/Makefile
@@ -1,7 +1,7 @@
#
# Makefile for utils/adt
#
-# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.46 2000/09/05 20:25:12 wieck Exp $
+# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.47 2000/09/29 17:17:33 petere Exp $
#
subdir = src/backend/utils/adt
@@ -9,8 +9,8 @@ top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
# seems to be required for some date/time stuff 1999/07/22 bjm
-ifeq ($(CPU),alpha)
-ifeq ($(GCC), yes)
+ifeq "$(findstring alpha,$(host_cpu))" "alpha"
+ifeq "$(GCC)" "yes"
CFLAGS+= -mieee
endif
endif
diff --git a/src/bin/scripts/createlang.sh b/src/bin/scripts/createlang.sh
index 0ba0edaa97b..145c83f2f56 100644
--- a/src/bin/scripts/createlang.sh
+++ b/src/bin/scripts/createlang.sh
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.15 2000/09/08 18:29:28 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.16 2000/09/29 17:17:34 petere Exp $
#
#-------------------------------------------------------------------------
@@ -237,7 +237,8 @@ if [ $? -ne 0 ]; then
fi
if [ "$res" ]; then
echo "$CMDNAME: '$langname' is already installed in database $dbname"
- exit 1
+ # separate exit status for "already installed"
+ exit 2
fi
# ----------
diff --git a/src/template/linux b/src/template/linux
index 2c823be7e5b..0c2d6601941 100644
--- a/src/template/linux
+++ b/src/template/linux
@@ -5,5 +5,4 @@ DLSUFFIX=.so
case $host_cpu in
mips*) CFLAGS="$CFLAGS -mips2";;
- alpha*) CPU=alpha;;
esac
diff --git a/src/test/Makefile b/src/test/Makefile
index fc3fb084717..7d31c4b5148 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -7,10 +7,9 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/test/Makefile,v 1.2 1996/11/12 11:42:41 bryanh Exp $
+# $Header: /cvsroot/pgsql/src/test/Makefile,v 1.3 2000/09/29 17:17:36 petere Exp $
#
#-------------------------------------------------------------------------
-.DEFAULT all:
- $(MAKE) -C bench $@
+.DEFAULT:
$(MAKE) -C regress $@
diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile
index 73d4a7e4e66..d787152e2e3 100644
--- a/src/test/regress/GNUmakefile
+++ b/src/test/regress/GNUmakefile
@@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.23 2000/08/31 16:12:26 petere Exp $
+# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.24 2000/09/29 17:17:37 petere Exp $
#
#-------------------------------------------------------------------------
@@ -15,67 +15,94 @@ subdir = src/test/regress
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
-CONTRIB= $(top_builddir)/contrib
-
-HOST := $(shell $(top_srcdir)/config/config.guess)
+contribdir := $(top_builddir)/contrib
CFLAGS+= -I$(libpq_srcdir) $(CFLAGS_SL)
LDADD+= $(libpq)
-
-#
-# DLOBJS is the dynamically-loaded object file. The regression test uses
-# this when it does a CREATE FUNCTION ... LANGUAGE 'C').
-#
-DLOBJS= regress$(DLSUFFIX)
-#
-# ... plus test query inputs
-#
-# INFILES is the files the regression test uses for input.
-INFILES= $(DLOBJS)
-#
-# plus exports files
-#
+##
+## Prepare for tests
+##
+
+# Build regression test driver
+
+all: pg_regress
+
+pg_regress: pg_regress.sh GNUmakefile
+ sed -e 's,@bindir@,$(bindir),g' \
+ -e 's,@libdir@,$(libdir),g' \
+ -e 's,@datadir@,$(datadir),g' \
+ -e 's/@VERSION@/$(VERSION)/g' \
+ -e 's/@host_tuple@/$(host_tuple)/g' \
+ $< >$@
+ chmod a+x $@
+
+
+# Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE 'C'.
+
+DLOBJS := regress$(DLSUFFIX)
+# This is for some platforms
ifdef EXPSUFF
-INFILES+= $(DLOBJS:.o=$(EXPSUFF))
+DLOBJS += regress$(EXPSUFF)
endif
+all: $(DLOBJS)
+
+
+# Build test input and expected files
+
+file_list := copy create_function_1 create_function_2 misc constraints
+input_files := $(foreach file, $(file_list), sql/$(file).sql)
+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)/$< >$@
+
+expected/%.out: output/%.source
+ pwd=`pwd` && sed "s,_OBJWD_,$$pwd,g;s/_DLSUFFIX_/$(DLSUFFIX)/g" $(srcdir)/$< >$@
+
+
+# And finally some extra C modules...
+
+all: all-spi
+
+.PHONY: all-spi
+all-spi:
+ $(MAKE) -C $(contribdir)/spi REFINT_VERBOSE=1 refint$(DLSUFFIX) autoinc$(DLSUFFIX)
+
+
+##
+## Run tests
+##
+
+check: all
+ ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=parallel_schedule --multibyte=$(MULTIBYTE)
+
+installcheck: all
+ ./pg_regress --schedule=serial_schedule --multibyte=$(MULTIBYTE)
+
+
+# old interfaces follow...
+
#
# huge extra tests run in target bigtest
#
EXTRA_TESTS = numeric_big
#
-# prepare to run the tests
-#
-all: $(INFILES)
- cd input; $(MAKE) all; cd ..
- cd output; $(MAKE) all; cd ..
-#ifneq ($(PORTNAME), win)
- $(MAKE) -C $(CONTRIB)/spi REFINT_VERBOSE=1 \
- refint$(DLSUFFIX) autoinc$(DLSUFFIX)
-#else
-# cat /dev/null > $(CONTRIB)/spi/refint$(DLSUFFIX)
-# cat /dev/null > $(CONTRIB)/spi/autoinc$(DLSUFFIX)
-#endif
-
-#ifeq ($(PORTNAME), win)
-#regress.dll: regress.c
-# cat /dev/null > $@
-#endif
-
-#
# run the tests
#
-runtest: $(INFILES)
+runtest: all
ifneq ($(PORTNAME), win)
MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
- $(SHELL) ./regress.sh $(HOST) 2>&1 | tee regress.out
+ $(SHELL) ./regress.sh $(host_tuple) 2>&1 | tee regress.out
else
MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
- ./regress.sh $(HOST) 2>&1 | tee regress.out
+ ./regress.sh $(host_tuple) 2>&1 | tee regress.out
endif
@echo "ACTUAL RESULTS OF REGRESSION TEST ARE NOW IN FILE regress.out"
@echo ""
@@ -86,26 +113,26 @@ endif
#
# run the test including the huge extra tests
#
-bigtest: $(INFILES)
+bigtest: all
ifneq ($(PORTNAME), win)
MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
- $(SHELL) ./regress.sh $(HOST) $(EXTRA_TESTS) 2>&1 | tee regress.out
+ $(SHELL) ./regress.sh $(host_tuple) $(EXTRA_TESTS) 2>&1 | tee regress.out
else
MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
- ./regress.sh $(HOST) $(EXTRA_TESTS) 2>&1 | tee regress.out
+ ./regress.sh $(host_tuple) $(EXTRA_TESTS) 2>&1 | tee regress.out
endif
@echo "ACTUAL RESULTS OF REGRESSION TEST ARE NOW IN FILE regress.out"
#
# run the parallel test suite
#
-runcheck: $(INFILES)
+runcheck: all
ifneq ($(PORTNAME), win)
MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
- $(SHELL) ./run_check.sh $(HOST)
+ $(SHELL) ./run_check.sh $(host_tuple)
else
MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
- ./run_check.sh $(HOST)
+ ./run_check.sh $(host_tuple)
endif
@echo "ACTUAL RESULTS OF REGRESSION TEST ARE NOW IN FILES run_check.out"
@echo "AND regress.out"
@@ -117,24 +144,27 @@ endif
#
# run the test including the huge extra tests
#
-bigcheck: $(INFILES)
+bigcheck: all
ifneq ($(PORTNAME), win)
MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
- $(SHELL) ./run_check.sh $(HOST) $(EXTRA_TESTS)
+ $(SHELL) ./run_check.sh $(host_tuple) $(EXTRA_TESTS)
else
MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
- ./run_check.sh $(HOST) $(EXTRA_TESTS)
+ ./run_check.sh $(host_tuple) $(EXTRA_TESTS)
endif
@echo "ACTUAL RESULTS OF REGRESSION TEST ARE NOW IN FILES run_check.out"
@echo "AND regress.out"
-clean:
- rm -f $(INFILES) regress.out run_check.out regress.o regression.diffs
+
+# clean up
+
+clean distclean maintainer-clean:
+# things built by `all' target
+ $(MAKE) -C $(contribdir)/spi clean
+ rm -f $(output_files) $(input_files) $(DLOBJS) regress.o pg_regress
+# things created by various check targets
+ rm -rf results tmp_check log
+ rm -f regression.diffs regression.out regress.out run_check.out
ifeq ($(PORTNAME), win)
rm -f regress.def
endif
- $(MAKE) -C sql clean
- $(MAKE) -C expected clean
- $(MAKE) -C results clean
- $(MAKE) -C $(CONTRIB)/spi clean
- rm -rf tmp_check
diff --git a/src/test/regress/expected/Makefile b/src/test/regress/expected/Makefile
deleted file mode 100644
index 285abb2c160..00000000000
--- a/src/test/regress/expected/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# Makefile--
-# Makefile for regress/expected (the regression test)
-#
-# Copyright (c) 1994, Regents of the University of California
-#
-#
-# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/test/regress/expected/Attic/Makefile,v 1.5 2000/01/09 19:34:41 tgl Exp $
-#
-#-------------------------------------------------------------------------
-
-CLFILES= create_function_1.out create_function_2.out copy.out constraints.out misc.out
-
-clean:
- rm -f $(CLFILES)
diff --git a/src/test/regress/input/Makefile b/src/test/regress/input/Makefile
deleted file mode 100644
index 10e1fbb1145..00000000000
--- a/src/test/regress/input/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# Makefile--
-# Makefile for regress/input (the regression test)
-#
-# Copyright (c) 1994, Regents of the University of California
-#
-#
-# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/test/regress/input/Attic/Makefile,v 1.9 2000/08/31 16:12:28 petere Exp $
-#
-#-------------------------------------------------------------------------
-
-subdir = src/test/regress/input
-top_builddir = ../../../..
-include $(top_builddir)/src/Makefile.global
-
-#
-# ... plus test query inputs
-#
-# INFILES is the files the regression test uses for input.
-INFILES= copy.sql \
- create_function_1.sql \
- create_function_2.sql \
- misc.sql \
- constraints.sql
-
-all: $(INFILES)
-
-%.sql: %.source
- if [ -z "$$USER" ]; then USER=$$LOGNAME; fi; \
- if [ -z "$$USER" ]; then USER=`whoami`; fi; \
- if [ -z "$$USER" ]; then echo 'Cannot deduce $$USER.'; exit 1; fi; \
- rm -f $@; \
- OBJ=`pwd`; \
- sed -e "s:_OBJWD_:$$OBJ/\.\.:g" \
- -e "s:_DLSUFFIX_:$(DLSUFFIX):g" \
- -e "s:_LIBDIR_:$(libdir):g" \
- -e "s/_USER_/$$USER/g" < $< > ../sql/$@
diff --git a/src/test/regress/output/Makefile b/src/test/regress/output/Makefile
deleted file mode 100644
index 377d10a5d4d..00000000000
--- a/src/test/regress/output/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# Makefile--
-# Makefile for regress/output (the regression test)
-#
-# Copyright (c) 1994, Regents of the University of California
-#
-#
-# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/test/regress/output/Attic/Makefile,v 1.11 2000/08/31 16:12:30 petere Exp $
-#
-#-------------------------------------------------------------------------
-
-subdir = src/test/regress/output
-top_builddir = ../../../..
-include $(top_builddir)/src/Makefile.global
-
-#
-# ... plus test query inputs
-#
-# INFILES is the files the regression test uses for input.
-INFILES= copy.out \
- create_function_1.out \
- create_function_2.out \
- misc.out \
- constraints.out
-
-all: $(INFILES)
-
-%.out: %.source
- if [ -z "$$USER" ]; then USER=$$LOGNAME; fi; \
- if [ -z "$$USER" ]; then USER=`whoami`; fi; \
- if [ -z "$$USER" ]; then echo 'Cannot deduce $$USER.'; exit 1; fi; \
- rm -f $@; \
- OBJ=`pwd`; \
- sed -e "s:_OBJWD_:$$OBJ/\.\.:g" \
- -e "s:_DLSUFFIX_:$(DLSUFFIX):g" \
- -e "s:_LIBDIR_:$(libdir):g" \
- -e "s/_USER_/$$USER/g" < $< | \
- sed -e "s:output/\.\.:input/\.\.:g" > ../expected/$@
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
new file mode 100644
index 00000000000..101f314b3fb
--- /dev/null
+++ b/src/test/regress/parallel_schedule
@@ -0,0 +1,75 @@
+# ----------
+# The first group of parallel test
+# ----------
+test: boolean char name varchar text int2 int4 int8 oid float4 float8 numeric
+
+# Depends on things setup during char, varchar and text
+test: strings
+# Depends on int2, int4, int8, float4, float8
+test: numerology
+
+# ----------
+# The second group of parallel test
+# ----------
+test: point lseg box path polygon circle date time timestamp interval abstime reltime tinterval inet comments oidjoins type_sanity opr_sanity
+
+# Depends on point, lseg, box, path, polygon and circle
+test: geometry
+# Depends on interval, timestamp, reltime and abstime
+test: horology
+
+# ----------
+# These four each depend on the previous one
+# ----------
+test: create_function_1
+test: create_type
+test: create_table
+test: create_function_2
+
+# ----------
+# Load huge amounts of data
+# We should split the data files into single files and then
+# execute two copy tests parallel, to check that copy itself
+# is concurrent safe.
+# ----------
+test: copy
+
+# ----------
+# The third group of parallel test
+# ----------
+test: constraints triggers create_misc create_aggregate create_operator create_index inherit
+
+# Depends on the above
+test: create_view
+
+# ----------
+# sanity_check does a vacuum, affecting the sort order of SELECT *
+# results. So it should not run parallel to other tests.
+# ----------
+test: sanity_check
+
+# ----------
+# Believe it or not, select creates a table, subsequent
+# tests need.
+# ----------
+test: errors
+test: select
+
+# ----------
+# The fourth group of parallel test
+# ----------
+ignore: random
+test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case join aggregates transactions random portals arrays btree_index hash_index
+
+test: misc
+
+# ----------
+# The fifth group of parallel test
+# ----------
+test: select_views alter_table portals_p2 rules foreign_key
+
+# ----------
+# The sixth group of parallel test
+# ----------
+# "plpgsql" cannot run concurrently with "rules"
+test: limit plpgsql temp
diff --git a/src/test/regress/pg_regress.sh b/src/test/regress/pg_regress.sh
new file mode 100644
index 00000000000..323035f0947
--- /dev/null
+++ b/src/test/regress/pg_regress.sh
@@ -0,0 +1,570 @@
+#! /bin/sh
+# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.1 2000/09/29 17:17:37 petere Exp $
+
+me=`basename $0`
+: ${TMPDIR=/tmp}
+TMPFILE=$TMPDIR/pg_regress.$$
+
+help="\
+PostgreSQL regression test driver
+
+Usage: $me [options...] [extra tests...]
+
+Options:
+ --debug turn on debug mode in programs that are run
+ --inputdir=DIR take input files from DIR (default \`.')
+ --multibyte=ENCODING use ENCODING as the multibyte encoding, and
+ also run a test by the same name
+ --outputdir=DIR place output files in DIR (default \`.')
+ --schedule=FILE use test ordering schedule from FILE
+ (may be used multiple times to concatenate)
+ --temp-install[=DIR] create a temporary installation (in DIR)
+
+Options for \`temp-install' mode:
+ --top-builddir=DIR (relative) path to top level build directory
+
+Options for using an existing installation:
+ --host=HOST use postmaster running on HOST
+ --port=PORT use postmaster running at PORT
+ --user=USER connect as USER
+
+The exit status is 0 if all tests passed, 1 if some tests failed, and 2
+if the tests could not be run for some reason.
+
+Report bugs to <pgsql-bugs@postgresql.org>."
+
+
+message(){
+ _dashes='==============' # 14
+ _spaces=' ' # 38
+ _msg=`echo "$1$_spaces" | cut -c 1-38`
+ echo "$_dashes $_msg $_dashes"
+}
+
+
+# ----------
+# Unset locale settings
+# ----------
+
+unset LC_COLLATE LC_CTYPE LC_MONETARY LC_MESSAGES LC_NUMERIC LC_TIME LC_ALL LANG LANGUAGE
+
+
+# ----------
+# Check for echo -n vs echo \c
+# ----------
+
+if echo '\c' | grep c >/dev/null 2>&1; then
+ ECHO_N='echo -n'
+ ECHO_C=''
+else
+ ECHO_N='echo'
+ ECHO_C='\c'
+fi
+
+
+# ----------
+# Initialize default settings
+# ----------
+
+: ${inputdir=.}
+: ${outputdir=.}
+
+libdir='@libdir@'
+bindir='@bindir@'
+datadir='@datadir@'
+host_platform='@host_triple@'
+
+unset mode
+unset schedule
+unset debug
+unset top_builddir
+unset temp_install
+unset multibyte
+
+dbname=regression
+hostname=`hostname` || hostname=localhost
+
+
+# ----------
+# Parse command line options
+# ----------
+
+while [ "$#" -gt 0 ]
+do
+ case $1 in
+ --help|-\?)
+ echo "$help"
+ exit 0;;
+ --version)
+ echo "pg_regress (PostgreSQL @VERSION@)"
+ exit 0;;
+ --debug)
+ debug=yes
+ shift;;
+ --inputdir=*)
+ inputdir=`expr "x$1" : "x--inputdir=\(.*\)"`
+ shift;;
+ --multibyte=*)
+ multibyte=`expr "x$1" : "x--multibyte=\(.*\)"`
+ shift;;
+ --temp-install)
+ temp_install=./tmp_check
+ shift;;
+ --temp-install=*)
+ temp_install=`expr "x$1" : "x--temp-install=\(.*\)"`
+ shift;;
+ --outputdir=*)
+ outputdir=`expr "x$1" : "x--outputdir=\(.*\)"`
+ shift;;
+ --schedule=*)
+ foo=`expr "x$1" : "x--schedule=\(.*\)"`
+ schedule="$schedule $foo"
+ shift;;
+ --top-builddir=*)
+ top_builddir=`expr "x$1" : "x--top-builddir=\(.*\)"`
+ shift;;
+ --host=*)
+ PGHOST=`expr "x$1" : "x--host=\(.*\)"`
+ shift;;
+ --port=*)
+ PGPORT=`expr "x$1" : "x--port=\(.*\)"`
+ shift;;
+ --user=*)
+ PGUSER=`expr "x$1" : "x--user=\(.*\)"`
+ export PGUSER
+ shift;;
+ -*)
+ echo "$me: invalid argument $1" 1>&2
+ exit 2;;
+ *)
+ extra_tests="$extra_tests $1"
+ shift;;
+ esac
+done
+
+
+# ----------
+# When on Windows or QNX, don't use Unix sockets.
+# ----------
+
+case $host_platform in
+ *-*-cygwin* | *-*-qnx*)
+ unix_sockets=no;;
+ *)
+ unix_sockets=yes;;
+esac
+
+[ "$unix_sockets" = no ] && psql_options="$psql_options -h $PGHOST"
+
+
+# ----------
+# Set up diff to ignore horizontal white space differences.
+# ----------
+
+case $host_platform in
+ *-*-qnx*)
+ DIFFFLAGS=-b;;
+ *)
+ DIFFFLAGS=-w;;
+esac
+
+
+# ----------
+# Set backend timezone and datestyle explicitly
+#
+# To pass the horology test in its current form, the postmaster must be
+# started with PGDATESTYLE=ISO, while the frontend must be started with
+# PGDATESTYLE=Postgres. We set the postmaster values here and change
+# to the frontend settings after the postmaster has been started.
+# ----------
+
+PGTZ='PST8PDT'; export PGTZ
+PGDATESTYLE='ISO,US'; export PGDATESTYLE
+
+
+# ----------
+# Exit trap to remove temp file and shut down postmaster
+# ----------
+
+# Note: There are some stupid shells (even among recent ones) that
+# ignore the argument to exit (as in `exit 1') if there is an exit
+# trap. The trap (and thus the shell script) will then always exit
+# with the result of the last shell command before the `exit'. Hence
+# we have to write `(exit x); exit' below this point.
+
+trap '
+ savestatus=$?
+ if [ -n "$postmaster_pid" ]; then
+ kill -2 "$postmaster_pid"
+ wait "$postmaster_pid"
+ unset postmaster_pid
+ fi
+ rm -f "$TMPFILE" && exit $savestatus
+' 0
+
+trap '
+ savestatus=$?
+ echo; echo "caught signal"
+ if [ -n "$postmaster_pid" ]; then
+ echo "signalling fast shutdown to postmaster with pid $postmaster_pid"
+ kill -2 "$postmaster_pid"
+ wait "$postmaster_pid"
+ unset postmaster_pid
+ fi
+ (exit $savestatus); exit
+' 1 2 13 15
+
+
+
+# ----------
+# Scan resultmap file to find which platform-specific expected files to use.
+# The format of each line of the file is
+# testname/hostplatformpattern=substitutefile
+# where the hostplatformpattern is evaluated per the rules of expr(1),
+# namely, it is a standard regular expression with an implicit ^ at the start.
+#
+# The tempfile hackery is needed because some shells will run the loop
+# inside a subshell, whereupon shell variables set therein aren't seen
+# outside the loop :-(
+# ----------
+
+cat /dev/null >$TMPFILE
+while read LINE
+do
+ HOSTPAT=`expr "$LINE" : '.*/\(.*\)='`
+ if [ `expr "$host_platform" : "$HOSTPAT"` -ne 0 ]
+ then
+ # remove hostnamepattern from line so that there are no shell
+ # wildcards in SUBSTLIST; else later 'for' could expand them!
+ TESTNAME=`expr "$LINE" : '\(.*\)/'`
+ SUBST=`echo "$LINE" | sed 's/^.*=//'`
+ echo "$TESTNAME=$SUBST" >> $TMPFILE
+ fi
+done <"$inputdir/resultmap"
+SUBSTLIST=`cat $TMPFILE`
+rm -f $TMPFILE
+
+
+LOGDIR=$outputdir/log
+
+if [ x"$temp_install" != x"" ]
+then
+ if echo x"$temp_install" | grep -v '^x/' >/dev/null 2>&1; then
+ temp_install="`pwd`/$temp_install"
+ fi
+
+ bindir=$temp_install/$bindir
+ libdir=$temp_install/$libdir
+ datadir=$temp_install/$datadir
+ PGDATA=$temp_install/data
+ PGHOST=$hostname
+ PGPORT=65432
+
+ # ----------
+ # Set up shared library paths, needed by psql and pg_encoding
+ # (if you run multibyte). LD_LIBRARY_PATH covers many platforms,
+ # feel free to account for others as well.
+ # ----------
+
+ if [ -n "$LD_LIBRARY_PATH" ]; then
+ LD_LIBRARY_PATH="$libdir:$LD_LIBRARY_PATH"
+ else
+ LD_LIBRARY_PATH=$libdir
+ fi
+ export LD_LIBRARY_PATH
+
+
+ if [ -d "$temp_install" ]; then
+ message "removing existing temp installation"
+ rm -rf "$temp_install"
+ fi
+
+ message "creating temporary installation"
+ mkdir -p "$LOGDIR" || { (exit 2); exit; }
+ ${MAKE:-gmake} -C "$top_builddir" DESTDIR="$temp_install" install >"$LOGDIR/install.log" 2>&1
+
+ if [ $? -ne 0 ]
+ then
+ echo
+ echo "$me: installation failed"
+ echo "Examine $LOGDIR/install.log for the reason."
+ echo
+ (exit 2); exit
+ fi
+
+
+ message "initializing database system"
+ [ "$debug" = yes ] && initdb_options='--debug'
+ "$bindir/initdb" -D "$PGDATA" -L "$datadir" --noclean $initdb_options >"$LOGDIR/initdb.log" 2>&1
+
+ if [ $? -ne 0 ]
+ then
+ echo
+ echo "$me: initdb failed"
+ echo "Examine $LOGDIR/initdb.log for the reason."
+ echo
+ (exit 2); exit
+ fi
+
+
+ # ----------
+ # Start postmaster
+ # ----------
+
+ message "starting postmaster"
+ [ "$debug" = yes ] && postmaster_options='$postmaster_options -d 5'
+ [ "$unix_sockets" = no ] && postmaster_options='$postmaster_options -i'
+ "$bindir/postmaster" -D "$PGDATA" -p "$PGPORT" -F $postmaster_options >"$LOGDIR/postmaster.log" 2>&1 &
+ postmaster_pid=$!
+
+ if kill -0 $postmaster_pid >/dev/null 2>&1
+ then
+ echo "running on port $PGPORT with pid $postmaster_pid"
+ else
+ echo
+ echo "$me: postmaster did not start"
+ echo "Examine $LOGDIR/postmaster.log for the reason."
+ echo
+ (exit 2); exit
+ fi
+
+ # give postmaster some time to pass WAL recovery
+ sleep 3
+
+else # not temp-install
+
+ if [ -n "$PGHOST" ]; then
+ echo "(using postmaster on $PGHOST at port $PGPORT)"
+ else
+ echo "(using postmaster on Unix socket with port $PGPORT)"
+ fi
+ message "dropping database \"$dbname\""
+ "$bindir/dropdb" -p "$PGPORT" $psql_options "$dbname" >/dev/null 2>&1
+ # errors can be ignored
+fi
+
+
+# ----------
+# Set up SQL shell for the test.
+# ----------
+
+PSQL="$bindir/psql -a -q -X $psql_options -p $PGPORT"
+
+
+# ----------
+# Set frontend timezone and datestyle explicitly
+# ----------
+
+PGTZ='PST8PDT'; export PGTZ
+PGDATESTYLE='Postgres,US'; export PGDATESTYLE
+
+
+# ----------
+# Set up multibyte environment
+# ----------
+
+if [ -n "$multibyte" ]; then
+ PGCLIENTENCODING=$multibyte
+ export PGCLIENTENCODING
+ encoding_opt="-E $multibyte"
+else
+ unset PGCLIENTENCODING
+fi
+
+
+# ----------
+# Create the regression database
+# ----------
+
+message "creating database \"$dbname\""
+"$bindir/createdb" -p "$PGPORT" $encoding_opt $psql_options "$dbname"
+if [ $? -ne 0 ]; then
+ echo "$me: createdb failed"
+ (exit 2); exit
+fi
+
+
+# ----------
+# Install the PL/pgSQL language in it
+# ----------
+
+case $host_platform in
+ *-*-qnx*) : ;;
+ *)
+ message "installing PL/pgSQL"
+ "$bindir/createlang" -p "$PGPORT" -L "$libdir" $psql_options plpgsql $dbname
+ if [ $? -ne 0 ] && [ $? -ne 2 ]; then
+ echo "$me: createlang failed"
+ (exit 2); exit
+ fi
+ ;;
+esac
+
+
+# ----------
+# Let's go
+# ----------
+
+message "running regression test queries"
+
+mkdir -p "$outputdir/results" || { (exit 2); exit; }
+result_summary_file=$outputdir/regression.out
+diff_file=$outputdir/regression.diffs
+
+cat /dev/null >"$result_summary_file"
+cat /dev/null >"$diff_file"
+
+lno=0
+(
+ cat $schedule
+ for x in $extra_tests; do
+ echo "test: $x"
+ done
+) | sed 's/[ ]*#.*//g' | \
+while read line
+do
+ # Count line numbers
+ lno=`expr $lno + 1`
+ [ -z "$line" ] && continue
+
+ set X $line; shift
+
+ if [ x"$1" = x"ignore:" ]; then
+ shift
+ ignore_list="$ignore_list $@"
+ continue
+ elif [ x"$1" != x"test:" ]; then
+ echo "$me:$schedule:$lno: syntax error"
+ (exit 2); exit
+ fi
+
+ shift
+
+ # ----------
+ # Start tests
+ # ----------
+
+ if [ $# -eq 1 ]; then
+ # Run a single test
+ formatted=`echo $1 | awk '{printf "%-20.20s", $1;}'`
+ $ECHO_N "test $formatted ... " $ECHO_C
+
+ $PSQL -d "$dbname" <"$inputdir/sql/$1.sql" >"$outputdir/results/$1.out" 2>&1
+ else
+ # Start a parallel group
+ $ECHO_N "parallel group ($# tests): " $ECHO_C
+ for name; do
+ ( $PSQL -d $dbname <"$inputdir/sql/$name.sql" >"$outputdir/results/$name.out" 2>&1
+ $ECHO_N " $name" $ECHO_C
+ ) &
+ done
+ wait
+ echo
+ fi
+
+ # ----------
+ # Run diff
+ # (We do not want to run the diffs immediately after each test,
+ # because they would certainly get corrupted if run in parallel
+ # subshells.)
+ # ----------
+
+ for name; do
+ if [ $# -ne 1 ]; then
+ formatted=`echo "$name" | awk '{printf "%-20.20s", $1;}'`
+ $ECHO_N " $formatted ... " $ECHO_C
+ fi
+
+ # Check list extracted from resultmap to see if we should compare
+ # to a system-specific expected file.
+ # There shouldn't be multiple matches, but take the last if there are.
+
+ EXPECTED="$inputdir/expected/${name}.out"
+ for LINE in $SUBSTLIST
+ do
+ if [ `expr "$LINE" : "$name="` -ne 0 ]
+ then
+ SUBST=`echo "$LINE" | sed 's/^.*=//'`
+ EXPECTED="$inputdir/expected/${SUBST}.out"
+ fi
+ done
+
+ diff $DIFFFLAGS $EXPECTED $outputdir/results/${name}.out >/dev/null 2>&1
+ case $? in
+ 0)
+ echo "ok";;
+ 1)
+ ( diff $DIFFFLAGS -C3 $EXPECTED $outputdir/results/${name}.out
+ echo
+ echo "======================================================================"
+ echo ) >> "$diff_file"
+ if echo " $ignore_list " | grep " $name " >/dev/null 2>&1 ; then
+ echo "failed (ignored)"
+ else
+ echo "FAILED"
+ fi
+ ;;
+ 2)
+ # desaster struck
+ echo "trouble" 1>&2
+ (exit 2); exit;;
+ esac
+ done
+done | tee "$result_summary_file" 2>&1
+
+[ $? -ne 0 ] && exit
+
+# ----------
+# Server shutdown
+# ----------
+
+if [ -n "$postmaster_pid" ]; then
+ message "shutting down postmaster"
+ kill -15 "$postmaster_pid"
+ unset postmaster_pid
+fi
+
+rm -f "$TMPFILE"
+
+
+# ----------
+# Evaluation
+# ----------
+
+count_total=`cat "$result_summary_file" | grep '\.\.\.' | wc -l | sed 's/ //g'`
+count_ok=`cat "$result_summary_file" | grep '\.\.\. ok' | wc -l | sed 's/ //g'`
+count_failed=`cat "$result_summary_file" | grep '\.\.\. FAILED' | wc -l | sed 's/ //g'`
+count_ignored=`cat "$result_summary_file" | grep '\.\.\. failed (ignored)' | wc -l | sed 's/ //g'`
+
+echo
+if [ $count_total -eq $count_ok ]; then
+ msg="All $count_total tests passed."
+ result=0
+elif [ $count_failed -eq 0 ]; then
+ msg="$count_ok of $count_total tests passed, $count_ignored failed test(s) ignored."
+ result=0
+elif [ $count_ignored -eq 0 ]; then
+ msg="$count_failed of $count_total tests failed."
+ result=1
+else
+ msg="$count_failed of $count_total tests failed, $count_ignored failed test(s) ignored."
+ result=1
+fi
+
+dashes=`echo " $msg " | sed 's/./=/g'`
+echo "$dashes"
+echo " $msg "
+echo "$dashes"
+echo
+
+if [ -s "$diff_file" ]; then
+ echo "The differences that caused some tests to fail can be viewed in the"
+ echo "file \`$diff_file'. A copy of the test summary that you see"
+ echo "above is saved in the file \`$result_summary_file'."
+ echo
+else
+ rm -f "$diff_file" "$result_summary_file"
+fi
+
+
+(exit $result); exit
diff --git a/src/test/regress/regress.sh b/src/test/regress/regress.sh
index a9521433f09..c5a4266a118 100755
--- a/src/test/regress/regress.sh
+++ b/src/test/regress/regress.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.52 2000/07/23 13:01:11 petere Exp $
+# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.53 2000/09/29 17:17:37 petere Exp $
#
if [ $# -eq 0 ]; then
echo "Syntax: $0 <hostname> [extra-tests]"
@@ -66,6 +66,8 @@ if [ -d ./obj ]; then
cd ./obj
fi
+mkdir results
+
echo "=============== Notes... ================="
echo "postmaster must already be running for the regression tests to succeed."
echo "The time zone is set to PST8PDT for these tests by the client frontend."
diff --git a/src/test/regress/run_check.sh b/src/test/regress/run_check.sh
index e985d8286ca..385c2900141 100755
--- a/src/test/regress/run_check.sh
+++ b/src/test/regress/run_check.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.25 2000/07/23 13:01:11 petere Exp $
+# $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.26 2000/09/29 17:17:37 petere Exp $
# ----------
# Check call syntax
@@ -162,6 +162,7 @@ fi
echo "=============== Create ./tmp_check directory ================"
mkdir -p $CHKDIR
mkdir -p $LOGDIR
+mkdir -p results
# ----------
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
new file mode 100644
index 00000000000..dbbe3d29577
--- /dev/null
+++ b/src/test/regress/serial_schedule
@@ -0,0 +1,74 @@
+test: boolean
+test: char
+test: name
+test: varchar
+test: text
+test: strings
+test: int2
+test: int4
+test: int8
+test: oid
+test: float4
+test: float8
+test: numerology
+test: point
+test: lseg
+test: box
+test: path
+test: polygon
+test: circle
+test: geometry
+test: date
+test: time
+test: timestamp
+test: interval
+test: abstime
+test: reltime
+test: tinterval
+test: horology
+test: inet
+test: comments
+test: oidjoins
+test: type_sanity
+test: opr_sanity
+test: create_function_1
+test: create_type
+test: create_table
+test: create_function_2
+test: constraints
+test: triggers
+test: copy
+test: create_misc
+test: create_aggregate
+test: create_operator
+test: create_view
+test: create_index
+test: sanity_check
+test: errors
+test: select
+test: select_into
+test: select_distinct
+test: select_distinct_on
+test: select_implicit
+test: select_having
+test: subselect
+test: union
+test: case
+test: join
+test: aggregates
+test: transactions
+ignore: random
+test: random
+test: portals
+test: misc
+test: arrays
+test: btree_index
+test: hash_index
+test: select_views
+test: alter_table
+test: portals_p2
+test: rules
+test: limit
+test: plpgsql
+test: temp
+test: numeric
diff --git a/src/test/regress/sql/Makefile b/src/test/regress/sql/Makefile
deleted file mode 100644
index 19b4424af45..00000000000
--- a/src/test/regress/sql/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# Makefile--
-# Makefile for regress/sql (the regression test)
-#
-# Copyright (c) 1994, Regents of the University of California
-#
-#
-# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/test/regress/sql/Attic/Makefile,v 1.5 2000/01/09 19:34:43 tgl Exp $
-#
-#-------------------------------------------------------------------------
-
-CLFILES= create_function_1.sql create_function_2.sql copy.sql misc.sql constraints.sql
-
-clean:
- rm -f $(CLFILES)