Commit Graph

77 Commits

Author SHA1 Message Date
Andrew Dunstan deb0129a22 fix typo 2017-07-16 12:01:13 -04:00
Andrew Dunstan fd2487e49f Fix vcregress.pl PROVE_FLAGS bug in commit 93b7d9731f
This change didn't adjust the publicly visible taptest function, causing
buildfarm failures on bowerbird.

Backpatch to 9.4 like previous change.
2017-07-16 11:24:29 -04:00
Andrew Dunstan 93b7d9731f Take PROVE_FLAGS from the command line but not the environment
This reverts commit 56b6ef893f and instead
makes vcregress.pl parse out PROVE_FLAGS from a command line argument
when doing a TAP test, thus making it consistent with the makefile
treatment.

Discussion: https://postgr.es/m/c26a7416-2fb9-34ab-7991-618c922f896e%402ndquadrant.com

Backpatch to 9.4 like previous patch.
2017-06-10 10:19:06 -04:00
Bruce Momjian ce55481032 Post-PG 10 beta1 pgperltidy run 2017-05-17 19:01:23 -04:00
Andrew Dunstan 56b6ef893f Honor PROVE_FLAGS environment setting
On MSVC builds and on back branches that means removing the hardcoded
--verbose setting. On master for Unix that means removing the empty
setting in the global Makefile so that the value can be acquired from
the environment as well as from the make arguments.

Backpatch to 9.4 where we introduced TAP tests
2017-05-12 11:11:49 -04:00
Andrew Dunstan 9a0d2008c3 Fix perl thinko in commit fed6df486d
Report and fix from Vaishnavi Prabakaran

Backpatch to 9.4 like original.
2017-05-02 08:20:11 -04:00
Andrew Dunstan fed6df486d Allow vcregress.pl to run an arbitrary TAP test set
Currently only provision for running the bin checks in a single step is
provided for. Now these tests can be run individually, as well as tests
in other locations (e.g. src.test/recover).

Also provide for suppressing unnecessary temp installs by setting the
NO_TEMP_INSTALL environment variable just as the Makefiles do.

Backpatch to 9.4.
2017-05-01 10:57:51 -04:00
Peter Eisentraut 4d33a7f2e7 Fix Perl code which had broken the Windows build
The previous change wanted to avoid modifying $_ in grep, but the code
just made the change in a local variable and then lost it.  Rewrite the
code using a separate map and grep, which is clearer anyway.

Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
2017-03-28 09:00:59 -04:00
Peter Eisentraut facde2a98f Clean up Perl code according to perlcritic
Fix all perlcritic warnings of severity level 5, except in
src/backend/utils/Gen_dummy_probes.pl, which is automatically generated.

Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
2017-03-27 08:18:22 -04:00
Peter Eisentraut 05cd12ed5b pg_ctl: Change default to wait for all actions
The different actions in pg_ctl had different defaults for -w and -W,
mostly for historical reasons.  Most users will want the -w behavior, so
make that the default.

Remove the -w option in most example and test code, so avoid confusion
and reduce verbosity.  pg_upgrade is not touched, so it can continue to
work with older installations.

Reviewed-by: Beena Emerson <memissemerson@gmail.com>
Reviewed-by: Ryan Murphy <ryanfmurphy@gmail.com>
2017-01-14 09:15:08 -05:00
Peter Eisentraut e574f15d62 Updates to reflect that pg_ctl stop -m fast is the default
Various example and test code used -m fast explicitly, but since it's
the default, this can be omitted now or should be replaced by a better
example.

pg_upgrade is not touched, so it can continue to operate with older
installations.
2017-01-13 21:25:36 -05:00
Noah Misch d299eb41df MSVC: Pass any user-set MSBFLAGS to MSBuild and VCBUILD.
This is particularly useful to pass /m, to perform a parallel build.

Christian Ullrich, reviewed by Michael Paquier.
2016-09-08 01:42:09 -04:00
Tom Lane b5bce6c1ec Final pgindent + perltidy run for 9.6. 2016-08-15 13:42:51 -04:00
Noah Misch fcd15f1358 Obstruct shell, SQL, and conninfo injection via database and role names.
Due to simplistic quoting and confusion of database names with conninfo
strings, roles with the CREATEDB or CREATEROLE option could escalate to
superuser privileges when a superuser next ran certain maintenance
commands.  The new coding rule for PQconnectdbParams() calls, documented
at conninfo_array_parse(), is to pass expand_dbname=true and wrap
literal database names in a trivial connection string.  Escape
zero-length values in appendConnStrVal().  Back-patch to 9.1 (all
supported versions).

Nathan Bossart, Michael Paquier, and Noah Misch.  Reviewed by Peter
Eisentraut.  Reported by Nathan Bossart.

Security: CVE-2016-5424
2016-08-08 10:07:46 -04:00
Tom Lane 18555b1323 Establish conventions about global object names used in regression tests.
To ensure that "make installcheck" can be used safely against an existing
installation, we need to be careful about what global object names
(database, role, and tablespace names) we use; otherwise we might
accidentally clobber important objects.  There's been a weak consensus that
test databases should have names including "regression", and that test role
names should start with "regress_", but we didn't have any particular rule
about tablespace names; and neither of the other rules was followed with
any consistency either.

This commit moves us a long way towards having a hard-and-fast rule that
regression test databases must have names including "regression", and that
test role and tablespace names must start with "regress_".  It's not
completely there because I did not touch some test cases in rolenames.sql
that test creation of special role names like "session_user".  That will
require some rethinking of exactly what we want to test, whereas the intent
of this patch is just to hit all the cases in which the needed renamings
are cosmetic.

There is no enforcement mechanism in this patch either, but if we don't
add one we can expect that the tests will soon be violating the convention
again.  Again, that's not such a cosmetic change and it will require
discussion.  (But I did use a quick-hack enforcement patch to find these
cases.)

Discussion: <16638.1468620817@sss.pgh.pa.us>
2016-07-17 18:42:43 -04:00
Tom Lane 30b2731bd2 Fix TAP tests and MSVC scripts for pathnames with spaces.
Change assorted places in our Perl code that did things like
	system("prog $path/file");
to do it more like
	system('prog', "$path/file");
which is safe against spaces and other special characters in the path
variable.  The latter was already the prevailing style, but a few bits
of code hadn't gotten this memo.  Back-patch to 9.4 as relevant.

Michael Paquier, Kyotaro Horiguchi

Discussion: <20160704.160213.111134711.horiguchi.kyotaro@lab.ntt.co.jp>
2016-07-09 16:47:38 -04:00
Noah Misch 3be0a62ffe Finish pgindent run for 9.6: Perl files. 2016-06-12 04:19:56 -04:00
Magnus Hagander cf086b1c2f Update helptext for vcregress.pl
This has clearly not been tracking the code changse for quite some time.

Michael Paquier, problem spotted by Kyotaro HORIGUCHI
2016-04-15 10:04:10 +02:00
Alvaro Herrera 49148645f7 Add a test framework for recovery
This long-awaited framework is an expansion of the existing PostgresNode
stuff to support additional features for recovery testing; the recovery
tests included in this commit are a starting point that cover some of
the recovery features we have.  More scripts are expected to be added
later.

Author: Michaël Paquier, a bit of help from Amir Rohan
Reviewed by: Amir Rohan, Stas Kelvich, Kyotaro Horiguchi, Victor Wagner,
Craig Ringer, Álvaro Herrera
Discussion: http://www.postgresql.org/message-id/CAB7nPqTf7V6rswrFa=q_rrWeETUWagP=h8LX8XAov2Jcxw0DRg@mail.gmail.com
Discussion: http://www.postgresql.org/message-id/trinity-b4a8035d-59af-4c42-a37e-258f0f28e44a-1443795007012@3capp-mailcom-lxa08
2016-02-26 16:13:30 -03:00
Andrew Dunstan f11c557e92 fix a perl typo 2015-11-19 02:42:02 -05:00
Andrew Dunstan d835dd6685 Improve vcregress.pl's handling of tap tests for client programs
The target is now named 'bincheck' rather than 'tapcheck' so that it
reflects what is checked instead of the test mechanism. Some of the
logic is improved, making it easier to add further sets of TAP based
tests in future. Also, the environment setting logic is imrpoved.

As discussed on -hackers a couple of months ago.
2015-11-18 22:47:41 -05:00
Noah Misch e6ea46c30e MSVC: Revert most 9.5 changes to pre-9.5 vcregress.pl tests.
The reverted changes did not narrow the semantic gap between the MSVC
build system and the GNU make build system.  For targets old and new
that run multiple suites (contribcheck, modulescheck, tapcheck), restore
vcregress.pl to mimicking "make -k" rather than the "make -S" default.
Lack of "-k" would be more burdensome than lack of "-S".  Keep changes
reflecting contemporary changes to the GNU make build system, and keep
updates to Makefile parsing.  Keep the loss of --psqldir in "check" and
"ecpgcheck" targets; it had been a no-op when used alongside
--temp-install.  No log message mentioned any of the reverted changes.
Based on a germ by Michael Paquier.  Back-patch to 9.5.
2015-07-29 22:48:56 -04:00
Noah Misch d6ab14674d MSVC: Remove duplicate PATH entry in test harness.
Back-patch to 9.5, where commit 4cb7d671fd
introduced it.
2015-07-29 22:48:43 -04:00
Heikki Linnakangas 13d856e177 Make TAP tests work on Windows.
On Windows, use listen_address=127.0.0.1 to allow TCP connections. We were
already using "pg_regress --config-auth" to set up HBA appropriately. The
standard_initdb helper function now sets up the server's
unix_socket_directories or listen_addresses in the config file, so that
they don't need to be specified in the pg_ctl command line anymore. That
way, the pg_ctl invocations in test programs don't need to differ between
Windows and Unix.

Add another helper function to configure the server's pg_hba.conf to allow
replication connections. The configuration is done similarly to "pg_regress
--config-auth": trust on domain sockets on Unix, and SSPI authentication on
Windows.

Replace calls to "cat" and "touch" programs with built-in perl code, as
those programs don't normally exist on Windows.

Add instructions in the docs on how to install IPC::Run on Windows. Adjust
vcregress.pl to not replace PERL5LIB completely in vcregress.pl, because
otherwise cannot install IPC::Run in a non-standard location easily.

Michael Paquier, reviewed by Noah Misch, some additional tweaking by me.
2015-07-29 19:17:02 +03:00
Andrew Dunstan d5d00294b0 Allow MSVC's contribcheck and modulescheck to run independently.
These require a temp install to have been done, so we now make sure it
is done before proceeding.

Michael Paquier.
2015-07-01 23:28:41 -04:00
Bruce Momjian 807b9e0dff pgindent run for 9.5 2015-05-23 21:35:49 -04:00
Tom Lane f5916bb7b5 Recognize "REGRESS_OPTS += ..." syntax in MSVC build scripts.
Necessitated by commit b14cf229f4.
Per buildfarm.
2015-05-18 13:40:06 -04:00
Andrew Dunstan eb010637dd Enable transforms tests for python 2 on MSVC builds
Currently regression tests for python 3 are disabled on MSVC, and these
tests fail with python 3, too, so we have some work to do to enable
both. Meanwhile, all the buildfarm hosts seem to be building with python
2 anyway, so this at least gets us some coverage.

Original patch from Michael Paquier, significantly modified by me.
2015-04-29 13:49:24 -04:00
Andrew Dunstan cbf9f0ec31 Fix MSVC builds for contrib transforms modules.
With this patch the MSVC build and installation will work correctly with
the transforms. However the python transform tests for hstore and ltree
are still disabled pending some further adjustments.

Michael Paquier with some tweaks from me.
2015-04-28 11:47:08 -04:00
Peter Eisentraut dcae5facca Improve speed of make check-world
Before, make check-world would create a new temporary installation for
each test suite, which is slow and wasteful.  Instead, we now create one
test installation that is used by all test suites that are part of a
make run.

The management of the temporary installation is removed from pg_regress
and handled in the makefiles.  This allows for better control, and
unifies the code with that of test suites not run through pg_regress.

review and msvc support by Michael Paquier <michael.paquier@gmail.com>

more review by Fabien Coelho <coelho@cri.ensmp.fr>
2015-04-23 08:59:52 -04:00
Alvaro Herrera 4cb7d671fd Add new target modulescheck in vcregress.pl
This allows an MSVC build to run regression tests related to modules in
src/test/modules.

Author: Michael Paquier
Reviewed by: Andrew Dunstan
2015-04-16 23:39:52 -03:00
Peter Eisentraut 9fa8b0ee90 Move pg_upgrade from contrib/ to src/bin/
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
2015-04-14 19:26:38 -04:00
Noah Misch 43b56171b1 Recognize Makefile line continuations in fetchRegressOpts().
Back-patch to 9.0 (all supported versions).  This is mere
future-proofing in the context of the master branch, but commit
f6dc6dd5ba requires it of older branches.
2014-12-18 03:55:17 -05:00
Noah Misch f6dc6dd5ba Lock down regression testing temporary clusters on Windows.
Use SSPI authentication to allow connections exclusively from the OS
user that launched the test suite.  This closes on Windows the
vulnerability that commit be76a6d39e
closed on other platforms.  Users of "make installcheck" or custom test
harnesses can run "pg_regress --config-auth=DATADIR" to activate the
same authentication configuration that "make check" would use.
Back-patch to 9.0 (all supported versions).

Security: CVE-2014-0067
2014-12-17 22:48:40 -05:00
Magnus Hagander 6964ad95d7 Add missing documentation for some vcregress modes
Michael Paquier
2014-12-17 11:14:34 +01:00
Noah Misch 31f9bbf059 MSVC: Substitute $(top_builddir) in REGRESS_OPTS.
Commit d7cdf6ee36 introduced a usage
thereof.  Back-patch to 9.0, like that commit.
2014-07-23 00:35:07 -04:00
Noah Misch 35d19a9a37 MSVC: Process Makefile line continuations more like "make" does.
Unlike "make" itself, the MSVC build process recognized a continuation
even with whitespace after the backslash.  (Due to a typo, some code
sites accepted the letter "s" instead of whitespace).  Also, it would
consume any number of newlines following a single backslash.  This is
mere cleanup; those behaviors were unlikely to cause bugs.
2014-07-14 14:07:27 -04:00
Tom Lane 8600031147 Fix obsolete config-module-exclusion logic in vcregress.pl.
The recent addition of regression tests to uuid-ossp exposed the fact
that the MSVC build system wasn't being consistent about whether it was
building/testing that contrib module, ie, it would try to test the module
even when it hadn't built it.  The same hazard was latent for sslinfo.

For the moment I just copied the more up-to-date logic from point A to
point B, but this is screaming for refactoring.

Per buildfarm results.
2014-05-27 22:31:21 -04:00
Andrew Dunstan ef158312e9 Attempt to get plpython regression tests working again for MSVC builds.
This has probably been broken for quite a long time. Buildfarm member
currawong's current results suggest that it's been broken since 9.1, so
backpatch this to that branch.

This only supports Python 2 - I will handle Python 3 separately, but
this is a fairly simple fix.
2014-04-16 13:35:46 -04:00
Andrew Dunstan a7e5f7bf68 Provide for client-only installs with MSVC.
MauMau.
2014-01-26 17:03:13 -05:00
Peter Eisentraut 87d8378f60 Fix whitespace 2013-11-13 21:25:52 -05:00
Andrew Dunstan 869b1e4a67 Fix isolation check for MSVC to handle recent changes. 2013-11-13 12:59:48 -05:00
Bruce Momjian 9af4159fce pgindent run for release 9.3
This is the first run of the Perl-based pgindent script.  Also update
pgindent instructions.
2013-05-29 16:58:43 -04:00
Andrew Dunstan b7f8465cc6 Avoid renaming data directory during MSVC upgrade testing.
This appears to cause some intermittent file system problems
on Windows 8. Instead, set up the old data directory in its
intended final location to start with.
2013-03-23 16:26:06 -04:00
Andrew Dunstan cd340ca89a Fix message typo. 2013-03-06 09:53:38 -05:00
Andrew Dunstan 06623df63b Allow a few seconds for Windows to catch up with a directory rename when checking pg_upgrade. 2012-10-02 10:40:57 -04:00
Andrew Dunstan a1d021e5d2 Add vcregress.pl target for checking pg_upgrade.
This follows recent addition of Windows/Mingw testing.
Backpatch to Release 9.2 so we can get some buildfarm testing
going.
2012-09-10 12:47:50 -04:00
Bruce Momjian 042d9ffc28 Run newly-configured perltidy script on Perl files.
Run on HEAD and 9.2.
2012-07-04 21:47:49 -04:00
Bruce Momjian 927d61eeff Run pgindent on 9.2 source tree in preparation for first 9.3
commit-fest.
2012-06-10 15:20:04 -04:00
Magnus Hagander fd6913a189 perltidy run over msvc build system 2011-07-12 15:25:08 +01:00