Commit Graph

186 Commits

Author SHA1 Message Date
Andrew Dunstan ec645ef346 Fix bad macro call noticed by MSVC compiler. 2011-05-15 18:45:26 -04:00
Andrew Dunstan c02d5b7c27 Use a macro variable PG_PRINTF_ATTRIBUTE for the style used for checking printf type functions.
The style is set to "printf" for backwards compatibility everywhere except
on Windows, where it is set to "gnu_printf", which eliminates hundreds of
false error messages from modern versions of gcc arising from  %m and %ll{d,u}
formats.
2011-04-28 10:56:14 -04:00
Peter Eisentraut f8ebe3bcc5 Support "make check" in contrib
Added a new option --extra-install to pg_regress to arrange installing
the respective contrib directory into the temporary installation.
This is currently not yet supported for Windows MSVC builds.

Updated the .gitignore files for contrib modules to ignore the
leftovers of a temp-install check run.

Changed the exit status of "make check" in a pgxs build (which still
does nothing) to 0 from 1.

Added "make check" in contrib to top-level "make check-world".
2011-04-25 22:27:11 +03:00
Andrew Dunstan 860be17ec3 Assorted minor changes to silence Windows compiler warnings.
Mostly to do with macro redefinitions or object signedness.
2011-04-25 12:56:53 -04:00
Andrew Dunstan ca5a75fbae Silence compiler warning about casting HANDLE to long on WIN64. 2011-04-19 11:21:00 -04:00
Peter Eisentraut f536d41942 Rename pg_regress option --multibyte to --encoding
Also refactor things a little bit so that the same methods for setting
test locale and encoding can be used everywhere.
2011-04-15 08:42:05 +03:00
Bruce Momjian bf50caf105 pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
Andrew Dunstan 5b079cb248 Use correct PATH separator for Cygwin in pg_regress.c.
This has been broken for years, and I'm not sure why it has not been
noticed before, but now a very modern Cygwin breaks on it, and the fix
is clearly correct. Backpatching to all live branches.
2011-03-17 00:06:52 -04:00
Tom Lane 63b656b7bf Create extension infrastructure for the core procedural languages.
This mostly just involves creating control, install, and
update-from-unpackaged scripts for them.  However, I had to adjust plperl
and plpython to not share the same support functions between variants,
because we can't put the same function into multiple extensions.

catversion bump forced due to new contents of pg_pltemplate, and because
initdb now installs plpgsql as an extension not a bare language.

Add support for regression testing these as extensions not bare
languages.

Fix a couple of other issues that popped up while testing this: my initial
hack at pg_dump binary-upgrade support didn't work right, and we don't want
an extra schema permissions test after all.

Documentation changes still to come, but I'm committing now to see
whether the MSVC build scripts need work (likely they do).
2011-03-04 21:51:14 -05:00
Peter Eisentraut 2fd77060a2 Allow make check in PL directories
Also add make check-world target, and refactor pg_regress invocation
code in makefiles a bit.
2011-02-15 06:52:12 +02:00
Robert Haas 968bc6fac9 sepgsql, an SE-Linux integration for PostgreSQL
This is still pretty rough - among other things, the documentation
needs work, and the messages need a visit from the style police -
but this gets the basic framework in place.

KaiGai Kohei
2011-01-23 20:48:27 -05:00
Bruce Momjian 5d950e3b0c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
Peter Eisentraut 387e468b82 Make output width consistent for all ways of invoking a regression test
run_schedule() and run_single_test() were using different output widths, which
would show up in bigcheck/bigtest, for example.
2010-12-04 17:34:48 +02:00
Magnus Hagander 9f2e211386 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
Bruce Momjian f904c797d6 Add missing --use-existing --help mention from regression binary.
Jan Urba?ski
2010-06-12 17:21:29 +00:00
Bruce Momjian 65e806cba1 pgindent run for 9.0 2010-02-26 02:01:40 +00:00
Tom Lane b951c03f88 Make pg_regress use CREATE OR REPLACE LANGUAGE, so that --load-language
will work whether or not the specified language is preinstalled.  This
responds to some complaints about having to change test scripts because
plpgsql is preinstalled as of 9.0.
2010-02-24 01:35:14 +00:00
Bruce Momjian 0239800893 Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
Simon Riggs efc16ea520 Allow read only connections during recovery, known as Hot Standby.
Enabled by recovery_connections = on (default) and forcing archive recovery using a recovery.conf. Recovery processing now emulates the original transactions as they are replayed, providing full locking and MVCC behaviour for read only queries. Recovery must enter consistent state before connections are allowed, so there is a delay, typically short, before connections succeed. Replay of recovering transactions can conflict and in some cases deadlock with queries during recovery; these result in query cancellation after max_standby_delay seconds have expired. Infrastructure changes have minor effects on normal running, though introduce four new types of WAL record.

New test mode "make standbycheck" allows regression tests of static command behaviour on a standby server while in recovery. Typical and extreme dynamic behaviours have been checked via code inspection and manual testing. Few port specific behaviours have been utilised, though primary testing has been on Linux only so far.

This commit is the basic patch. Additional changes will follow in this release to enhance some aspects of behaviour, notably improved handling of conflicts, deadlock detection and query cancellation. Changes to VACUUM FULL are also required.

Simon Riggs, with significant and lengthy review by Heikki Linnakangas, including streamlined redesign of snapshot creation and two-phase commit.

Important contributions from Florian Pflug, Mark Kirkwood, Merlin Moncure, Greg Stark, Gianni Ciolli, Gabriele Bartolini, Hannu Krosing, Robert Haas, Tatsuo Ishii, Hiroyuki Yamada plus support and feedback from many other community members.
2009-12-19 01:32:45 +00:00
Tom Lane 8d97c1dcfa Use diff's -w switch only on Windows, to avoid problems with inconsistent
newline representations.  Per buildfarm results and subsequent discussion.
Sync up a couple of other places that had their own policies.
2009-11-23 16:02:24 +00:00
Tom Lane ce3153fa93 Remove -w (--ignore-all-space) option from pg_regress's diff calls.
We have used -w for a long time as a means of reducing the reported diff
volume when one element of a result table isn't of the expected width.
However, most of the time the results just pass anyway, so this isn't as
important as it once was.  Meanwhile, the risk of missing potentially
significant deviations has gone up, particularly with psql's ability to
report error cursor positions.  So, let's switch over to space-sensitive
comparisons.  Per my proposal of yesterday.

(All the expected files that I can test here seem to be ready for this
already, but we'll see what the buildfarm thinks about others.)
2009-11-22 17:54:23 +00:00
Magnus Hagander da8d684d39 Add inheritable ACE when creating a restricted token for execution on
Win32.

Also refactor the code around it to be more clear.

Jesse Morris
2009-11-14 15:39:36 +00:00
Teodor Sigaev a88a48011c Introduce filtering dictionary support to tsearch. Propagate --nolocale option
to CREATE DATABASE command in pg_regress to allow correct checking of
locale-sensitive contrib modules.
2009-08-18 10:30:41 +00:00
Bruce Momjian d747140279 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
2009-06-11 14:49:15 +00:00
Tom Lane 8d4f2ecd41 Change the default value of max_prepared_transactions to zero, and add
documentation warnings against setting it nonzero unless active use of
prepared transactions is intended and a suitable transaction manager has been
installed.  This should help to prevent the type of scenario we've seen
several times now where a prepared transaction is forgotten and eventually
causes severe maintenance problems (or even anti-wraparound shutdown).

The only real reason we had the default be nonzero in the first place was to
support regression testing of the feature.  To still be able to do that,
tweak pg_regress to force a nonzero value during "make check".  Since we
cannot force a nonzero value in "make installcheck", add a variant regression
test "expected" file that shows the results that will be obtained when
max_prepared_transactions is zero.

Also, extend the HINT messages for transaction wraparound warnings to mention
the possibility that old prepared transactions are causing the problem.

All per today's discussion.
2009-04-23 00:23:46 +00:00
Peter Eisentraut c1c1886d82 Unset language-related locale settings in any case, otherwise psql will
speak in tongues and mess up the regression test diffs.
2009-02-12 13:26:03 +00:00
Peter Eisentraut 20a43b16b4 Only unset the locale environment when --no-locale is used (the way it was
presumably designed, but didn't act).  This allows running the temp install
tests in a non-C locale, thus exercising users' real environments better.
Document how to change locales for test runs.
2009-02-11 14:03:42 +00:00
Magnus Hagander 61fd2c51d8 Change warning-silencing code not to cast the pointer type, instead
casting the value of the variable later.

Per comments from Tom.
2009-01-28 15:32:21 +00:00
Magnus Hagander 6b73366520 Silence compiler warning on win32.
ITAGAKI Takahiro
2009-01-27 12:46:16 +00:00
Bruce Momjian 9bdf216f9c Fix memory leak for file name if expect file name contains a dot, per
report from dvice_null@yahoo.com.
2009-01-08 20:09:06 +00:00
Bruce Momjian 511db38ace Update copyright for 2009. 2009-01-01 17:24:05 +00:00
Peter Eisentraut 218b4e8dd8 Append major version number and for libraries soname major version number
to the gettext domain name, to simplify parallel installations.

Also, rename set_text_domain() to pg_bindtextdomain(), because that is what
it does.
2008-12-11 07:34:09 +00:00
Peter Eisentraut 2939e20037 Reduce risk of accidentally running temp-install regression tests against
a mismatching installation.  Pick a default port number calculated from the
version number, and try a few times with other numbers if that one doesn't
work.  Check if we can connect to the port before starting our own postmaster,
to detect some other server already running there.  To simplify the code,
drop --temp-port option and use --port for both temp-install and pre-installed
case.
2008-11-28 12:45:34 +00:00
Tom Lane d703de2989 Let's see if using -c instead of -- style fixes the PGOPTIONS issue. 2008-11-26 13:26:52 +00:00
Tom Lane 1304f297a4 Remove PGINTERVALSTYLE from the set of special environment variables for
libpq.  As noted by Peter, adding this variable created a risk of unexpected
connection failures when talking to older server versions, and since it
doesn't do anything you can't do with PGOPTIONS, it doesn't seem really
necessary.  Removing it does occasion a few extra lines in pg_regress.c,
but saving a getenv() call per libpq connection attempt is perhaps worth
that anyway.
2008-11-25 19:30:42 +00:00
Peter Eisentraut 45fe3afc04 If pg_ctl stop fails, print an error message and exit (instead of going out
of our way to ignore the exit status).  If this ever really happens, worst
case you will not see the "score" at the bottom of the test run.
2008-11-25 11:49:35 +00:00
Magnus Hagander 284491ee71 Silence compiler warning about ignored return value. Our comment already
clearly stated that we are aware that we're ignoring it.
2008-11-20 15:03:39 +00:00
Tom Lane df7641e25a Add a new GUC variable called "IntervalStyle" that decouples interval output
from DateStyle, and create a new interval style that produces output matching
the SQL standard (at least for interval values that fall within the standard's
restrictions).  IntervalStyle is also used to resolve the conflict between the
standard and traditional Postgres rules for interpreting negative interval
input.

Ron Mayer
2008-11-09 00:28:35 +00:00
Peter Eisentraut feae7856af Allow pg_regress to be run outside the build tree. Look for input files
in both input and output dir, to handle vpath builds more simply.
2008-10-01 22:38:57 +00:00
Tom Lane 7e61edf2e7 Fix some message style guideline violations in pg_regress, as well as
some failures to expose messages for translation.
2008-08-05 05:16:08 +00:00
Tom Lane 3c93218aeb Fix copy-and-pasteo that's causing pg_regress to lie about which file it can't
read when the --temp-config argument is bad.  Noted while wondering why
buildfarm member dungbeetle is failing ... this isn't why, but it is why
the error report isn't very helpful ...
2008-08-03 05:12:38 +00:00
Tom Lane 55de145d1c Improve pg_regress so that it reports the fact if any test process
exits with nonzero status.  The Windows part of this is untested ...
2008-05-17 20:02:01 +00:00
Tom Lane c5f11f9d19 Fix a number of places that were making file-type tests infelicitously.
The places that did, eg,
	(statbuf.st_mode & S_IFMT) == S_IFDIR
were correct, but there is no good reason not to use S_ISDIR() instead,
especially when that's what the other 90% of our code does.  The places
that did, eg,
	(statbuf.st_mode & S_IFDIR)
were flat out *wrong* and would fail in various platform-specific ways,
eg a symlink could be mistaken for a regular file on most Unixen.

The actual impact of this is probably small, since the problem cases
seem to always involve symlinks or sockets, which are unlikely to be
found in the directories that PG code might be scanning.  But it's
clearly trouble waiting to happen, so patch all the way back anyway.
(There seem to be no occurrences of the mistake in 7.4.)
2008-03-31 01:31:43 +00:00
Magnus Hagander 9b8a93baa4 Use windows DACL fix for pg_regress as well.
Dave Page
2008-03-04 15:38:31 +00:00
Tom Lane 8dd6c4b4be Make pg_regress -V consistent with the corresponding code in other
programs: use puts with a compile-time-constant string.
2008-02-20 22:44:16 +00:00
Tom Lane f10589e5f7 Make pg_regress clean out the testtablespace directory only on Windows.
On other platforms it's better to let the Makefile handle it, but we want
the regression tests to be invokable without make on Windows.  A batch
file would be a better solution, but no time for that before 8.3.
Per my discovery that this breaks testing under SELinux, and subsequent
discussion.
2008-01-19 17:43:42 +00:00
Bruce Momjian 9098ab9e32 Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
Tom Lane 42fd80de53 Fix pg_regress to check the directory it is actually reading files from,
not the image that (theoretically) should exist in the current directory.

Jørgen Austvik
2007-11-27 19:13:30 +00:00
Bruce Momjian fdf5a5efb7 pgindent run for 8.3. 2007-11-15 21:14:46 +00:00
Andrew Dunstan 0cb74d3cec Provide for a file specifying non-standard config options for temp install
for pg_regress, via --temp-config option. Pick this up in the make file
via TEMP_CONFIG setting.
2007-09-09 20:40:54 +00:00
Alvaro Herrera cdedfe6af1 Cast NULL to a pointer type in the execl() call, to avoid a compiler warning on
some platforms and possibly a bug.  Per report from Stefan and subsequent
discussion.
2007-07-18 21:19:17 +00:00
Magnus Hagander a0de6e7b97 Specifying a dbname should override the default database, not add to it.
Fixes buildfarm failures on contribcheck.
2007-06-12 13:54:58 +00:00
Magnus Hagander 8c0d308818 Fix missing variable initialization. 2007-06-12 13:26:45 +00:00
Magnus Hagander 09922597c5 Rewrite ECPG regression test driver in C, by splitting the standard
regression driver into two parts and reusing half of it. Required to
run ECPG tests without a shell on MSVC builds.

Fix ECPG thread tests for MSVC build (incl output files).

Joachim Wieland and Magnus Hagander
2007-06-12 11:07:34 +00:00
Peter Eisentraut 7ce9b3683e Make some messages more consistent 2007-05-31 15:13:06 +00:00
Tom Lane 4a30da1e7f Add missing #define for mingw, per Magnus. 2007-02-08 19:48:28 +00:00
Bruce Momjian 6fea31b693 Win32 regression test fixes:
For win32 in general, this makes it possible to run the regression tests
as an admin user by using the same restricted token method that's used
by pg_ctl and initdb.

For vc++, it adds building of pg_regress.exe, adds a resultmap, and
fixes how it runs the install.

Magnus Hagander
2007-02-08 15:28:58 +00:00
Peter Eisentraut 16059d39a0 Replace some strncpy() by strlcpy(). 2007-02-07 00:52:35 +00:00
Bruce Momjian 8b4ff8b6a1 Wording cleanup for error messages. Also change can't -> cannot.
Standard English uses "may", "can", and "might" in different ways:

        may - permission, "You may borrow my rake."

        can - ability, "I can lift that log."

        might - possibility, "It might rain today."

Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice.  Similarly, "It may crash" is better stated, "It might crash".
2007-02-01 19:10:30 +00:00
Alvaro Herrera 67a4c24bc8 Fix pg_regress breakage for PL and contrib tests, by not requiring that
"input" and "output" dirs be necessarily present.
2007-01-19 21:21:13 +00:00
Alvaro Herrera 5b4a08896b Change the sed rules in the regression test for pg_regress hackery to create
the generated files, to help Visual C++ to run these tests.  The tests still
pass in VPATH and normal builds.

Patch from Magnus Hagander, editorialized by me.
2007-01-19 16:42:24 +00:00
Bruce Momjian 29dccf5fe0 Update CVS HEAD for 2007 copyright. Back branches are typically not
back-stamped for this.
2007-01-05 22:20:05 +00:00
Andrew Dunstan 226e9fffc8 Call setrlimit if possible in pg_regress to allow core file generation, and provide a switch for similar behaviour in pg_ctl. 2007-01-05 16:17:55 +00:00
Bruce Momjian f99a569a2e pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
Tom Lane f375d5d6f9 Cause pg_regress to invoke the temporary postmaster as 'postgres' not
'postmaster', so as not to depend on the existence of the postmaster
symlink.  Also, implement postmaster-still-alive and postmaster-kill
operations for Windows, per Magnus.
2006-09-24 17:10:18 +00:00
Tom Lane 9b5e108ee9 Fix shared library creation to work properly on AIX. Albe Laurenz 2006-09-19 15:36:08 +00:00
Tom Lane fbc7f59bfe If test postmaster fails to start within 60 seconds, try to kill -9 it
so that it won't interfere with later trials.  Per recent buildfarm
experience.  Anyone know how to do this on Windows?
2006-08-13 20:39:07 +00:00
Bruce Momjian 9a4eaa9440 Remove extra argument to printf(). 2006-08-01 18:01:36 +00:00
Andrew Dunstan a3bae60813 have pg_regress fall back on testing with the canonical results file if an
alternative test is specified but none succeeds.
2006-08-01 14:56:29 +00:00
Bruce Momjian 1a271f0c71 Fix WIN32 wait() return value macros to be accurate, particularly
because they are used for testing the return value from system().
(WIN32 doesn't overlay the return code with other failure conditions
like Unix does, so they are just simple macros.)

Fix regression checks to properly handle diff failures on Win32 using
the new macros.
2006-07-30 01:45:21 +00:00
Tom Lane 8aab197840 Original coding of pg_regress.c made the results and log directories
with restrictive permissions, which was not the behavior of the shell
script and doesn't seem very desirable.  Use the umask setting instead.
2006-07-27 15:37:19 +00:00
Tom Lane d8b5c95ca8 Remove hard-wired lists of timezone abbreviations in favor of providing
configuration files that can be altered by a DBA.  The australian_timezones
GUC setting disappears, replaced by a timezone_abbreviations setting (set this
to 'Australia' to get the effect of australian_timezones).  The list of zone
names defined by default has undergone a bit of cleanup, too.  Documentation
still needs some work --- in particular, should we fix Table B-4, or just get
rid of it?  Joachim Wieland, with some editorializing by moi.
2006-07-25 03:51:23 +00:00
Andrew Dunstan 631ea61883 Use correct ifdef test for cygwin, namely __CYGWIN__ (note underscores). 2006-07-25 01:37:42 +00:00
Andrew Dunstan 20a733d0a0 Remove dubious and redundant (we think) setting of libdir in PATH for non temp-install case. 2006-07-24 01:50:22 +00:00
Andrew Dunstan b0dc1fbbc5 Add libdir to PATH for Cygwin as well as WIN32 - should fix buildfarm eel. 2006-07-22 14:05:20 +00:00
Tom Lane bc660c4237 Ah, I finally realize why Magnus wanted to add a --bindir option to
pg_regress: there's no other way to cope with testing a relocated
installation.  Seems better to call it --psqldir though, since the
only thing we need to find in that case is psql.  It'd be better if
we could use find_other_exec, but that's not happening unless we are
willing to install pg_regress alongside psql, which seems unlikely
to happen.
2006-07-21 00:24:04 +00:00
Tom Lane 11f6d2fcba As a stopgap to get the Windows buildfarm members running again, hot-wire
the check on diff's exit status to check for literally 0 or 1.  Someone
should look into why WIFEXITED/WEXITSTATUS don't work for this, but I've
spent more than enough time on it already.
2006-07-20 16:25:30 +00:00
Tom Lane 7da24bcbc1 Print out diff status code when we think there's a hard failure.
May help in debugging behavior on Windows.
2006-07-20 03:30:58 +00:00
Tom Lane c3104376f9 Suppress unused-variable compiler warning, per Andrew Dunstan. 2006-07-20 02:15:17 +00:00
Tom Lane 27a83103ea Fix pg_regress.c to report tests in a parallel group when they finish,
not when they're started.  This mimics a subtle point of the behavior
of the old shell script, and gives better feedback when watching the
tests.
2006-07-20 02:10:00 +00:00
Tom Lane 5652ea703b Make pg_regress.c get paths from pg_config_paths.h, instead of -D
switches passed from the Makefile.  This looks like it will fix
problem with virtual vs real paths under msys.
2006-07-20 01:16:57 +00:00
Tom Lane 60cfe25e68 Adjust spawn_process() to avoid unnecessary overhead processes: we can
just exec instead of creating a subprocess.  This reduces process usage
from four processes per parallel test to two.  I have no idea whether
a comparable optimization is possible or useful in the Windows port.
2006-07-19 17:02:59 +00:00
Tom Lane 5b8b137b16 Adjust pg_regress to print out the exact string given to system() when
'make install' or 'initdb' fails.  Also minor simplification of fgets()
usage --- fgets guarantees a trailing null anyway.
2006-07-19 16:23:17 +00:00
Tom Lane fe2c4e414a kill() is declared in <signal.h> per Single Unix Spec. 2006-07-19 05:21:57 +00:00
Tom Lane 1c5531b108 Tweak command quoting for Windows (I'd forgotten about SYSTEMQUOTE). 2006-07-19 04:50:57 +00:00
Tom Lane a38c85bd5d Rewrite pg_regress as a C program instead of a shell script.
This allows it to be used on Windows without installing mingw
(though you do still need 'diff'), and opens the door to future
improvements such as message localization.
Magnus Hagander and Tom Lane.
2006-07-19 02:37:00 +00:00