summaryrefslogtreecommitdiff
path: root/src/test/perl/TestLib.pm
AgeCommit message (Collapse)Author
2017-03-27Clean up Perl code according to perlcriticPeter Eisentraut
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 <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]>
2016-10-01Set log_line_prefix and application name in test driversPeter Eisentraut
Before pg_regress runs psql, set the application name to the test name. Similarly, set the application name to the test file name in the TAP tests. Also, set a default log_line_prefix that show the application name, as well as the PID and a time stamp. That way, the server log output can be correlated to the test input files, making debugging a bit easier.
2016-09-22Add tests for various connection string issuesPeter Eisentraut
Add tests for consistent support of connection strings in frontend programs as well as proper handling of unusual characters in database and user names. These tests were developed for the issues of CVE-2016-5424. To allow testing of names with spaces, change the pg_regress command-line options --create-role and --dbname to split their arguments by comma only, not space or comma as before. Only commas were actually used in existing uses. Noah Misch, Michael Paquier, Peter Eisentraut
2016-09-21pg_ctl: Add tests for promote actionPeter Eisentraut
Reviewed-by: Michael Paquier <[email protected]>
2016-09-21Make command_like output more compactPeter Eisentraut
Consistently print the test name, not the full command, which can be quite lenghty and include temporary directory names and other distracting details. Reviewed-by: Michael Paquier <[email protected]>
2016-06-12Finish pgindent run for 9.6: Perl files.Noah Misch
2016-04-02Copyedit comments and documentation.Noah Misch
2016-03-02Prefix temp data dirs with the node nameAlvaro Herrera
This makes it easier to relate the temporary data dirs to each node in a test script. Author: Kyotaro Horiguchi Reviewed-By: Craig Ringer, Alvaro Herrera
2016-03-02Fix TAP tests for older Perls.Tom Lane
Commit 7132810c (Retain tempdirs for failed tests) used Test::More's is_passing method, but that was added in Test::More 0.89_01 which is sometime later than Perl 5.10.1. Popular platforms such as RHEL6 don't have that, nevermind some of our older dinosaurs. Do it the hard way. Michael Paquier, based on research by Craig Ringer
2016-03-01TAP tests: retain temp dirs on test failureAlvaro Herrera
This makes it easier to study the reason for the failure. Author: Kyotaro Horiguchi Reviewed-By: Craig Ringer
2015-12-08Avoid odd portability problem in TestLib.pm's slurp_file function.Tom Lane
For unclear reasons, this function doesn't always read the expected data in some old Perl versions. Rewriting it to avoid use of ARGV seems to dodge the problem, and this version is clearer anyway if you ask me. In passing, also improve error message in adjacent append_to_file function.
2015-12-05Create TestLib.pm's tempdir underneath tmp_check/, not out in the open.Tom Lane
This way, existing .gitignore entries and makefile clean actions will automatically apply to the tempdir, should it survive a TAP test run (which can happen if the user control-C's out of the run, for example). Michael Paquier, per a complaint from me
2015-12-03Fix broken subroutine call in TestLibAlvaro Herrera
Michael Paquier
2015-12-02Refactor Perl test codeAlvaro Herrera
The original code was a bit clunky; make it more amenable for further reuse by creating a new Perl package PostgresNode, which is an object-oriented representation of a single server, with some support routines such as init, start, stop, psql. This serves as a better basis on which to build further test code, and enables writing tests that use more than one server without too much complication. This commit modifies a lot of the existing test files, mostly to remove explicit calls to system commands (pg_ctl) replacing them with method calls of a PostgresNode object. The result is quite a bit more straightforward. Also move some initialization code to BEGIN and INIT blocks instead of having it straight in as top-level code. This commit also introduces package RecursiveCopy so that we can copy whole directories without having to depend on packages that may not be present on vanilla Perl 5.8 installations. I also ran perltidy on the modified files, which changes some code sites that are not otherwise touched by this patch. I tried to avoid this, but it ended up being more trouble than it's worth. Authors: Michael Paquier, Álvaro Herrera Review: Noah Misch
2015-09-03Disable fsync throughout TAP test suites.Noah Misch
Most suites already did so via start_test_server(), but the pg_rewind, pg_ctl and pg_controldata suites ran a postmaster or initdb with fsync enabled. This halves the pg_rewind suite's runtime on buildfarm member tern. It makes tern and that machine's other buildfarm members less vulnerable to noise failures from postmaster startup overrunning the 60s pg_ctl timeout. Back-patch to 9.5, where pg_rewind was introduced.
2015-08-05Remove carriage returns from certain tap test output under MsysAndrew Dunstan
These were causing spurious test failures.
2015-08-03Allow TAP tests to run under MsysAndrew Dunstan
The Msys DTK perl, which is required to run TAP tests under Msys as a native perl won't recognize the correct virtual paths, has its osname recorded in the Config module as 'msys' instead of 'MSWin32'. To avoid having to repeat the test a variable is created that is true iff the osname is either of these values, and is then used everywhere that matters.
2015-07-29Make TAP tests work on Windows.Heikki Linnakangas
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-29pg_basebackup: Add --slot optionPeter Eisentraut
This option specifies a replication slot for WAL streaming (-X stream), so that there can be continuous replication slot use between WAL streaming during the base backup and the start of regular streaming replication. Reviewed-by: Michael Paquier <[email protected]>
2015-07-29pg_basebackup: Add tests for -X optionPeter Eisentraut
Reviewed-by: Michael Paquier <[email protected]>
2015-07-29pg_basebackup: Add tests for -R optionPeter Eisentraut
Reviewed-by: Michael Paquier <[email protected]>
2015-07-28Make tap tests store postmaster logs and handle vpaths correctlyAndrew Dunstan
Given this it is possible that the buildfarm animals running these tests will be able to capture adequate logging to allow diagnosis of failures.
2015-07-09Improve logging of TAP tests.Heikki Linnakangas
Create a log file for each test run. Stdout and stderr of the test script, as well as any subprocesses run as part of the test, are redirected to the log file. This makes it a lot easier to debug test failures. Also print the test output (ok 12 - ... messages) to the log file, and the command line of any external programs executed with the system_or_bail and run_log functions. This makes it a lot easier to debug failing tests. Modify some of the pg_ctl and other command invocations to not use 'silent' or 'quiet' options, and don't redirect output to /dev/null, so that you get all the information in the log instead. In the passing, construct some command lines in a way that works if $tempdir contains quote-characters. I haven't systematically gone through all of them or tested that, so I don't know if this is enough to make that work. pg_rewind tests had a custom mechanism for creating a similar log file. Use the new generic facility instead. Michael Paquier and me.
2015-05-24pgindent run for 9.5Bruce Momjian
2014-12-18Fix previous commit for TAP test suites in VPATH builds.Noah Misch
Per buildfarm member crake. Back-patch to 9.4, where the TAP suites were introduced.
2014-12-18Lock down regression testing temporary clusters on Windows.Noah Misch
Use SSPI authentication to allow connections exclusively from the OS user that launched the test suite. This closes on Windows the vulnerability that commit be76a6d39e2832d4b88c0e1cc381aa44a7f86881 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-11-02Add configure --enable-tap-tests optionPeter Eisentraut
Don't skip the TAP tests anymore when IPC::Run is not found. This will fail normally now.
2014-10-29Remove use of TAP subtestsPeter Eisentraut
They turned out to be too much of a portability headache, because they need a fairly new version of Test::More to work properly.
2014-10-26Fix TAP tests with Perl 5.12Peter Eisentraut
Perl 5.12 ships with a somewhat broken version of Test::Simple, so skip the tests if that is found. The relevant fix is 0.98 Wed, 23 Feb 2011 14:38:02 +1100 Bug Fixes * subtest() should not fail if $? is non-zero. (Aaron Crane)
2014-09-11Handle old versions of Test::MorePeter Eisentraut
Really old versions of Test::More don't support subplans, so skip the tests in that case.
2014-07-24Fix TAP installcheck tests when current directory name contains spacesPeter Eisentraut
This fixes the installcheck part. The check part has additional problems that will be addressed in a separate commit.
2014-07-22Unset some local environment variables in TAP testsPeter Eisentraut
Unset environment variables that control message language, so that we can compare some program output with expected strings. This is very similar to what pg_regress does.
2014-07-03Use a separate temporary directory for the Unix-domain socketPeter Eisentraut
Creating the Unix-domain socket in the build directory can run into name-length limitations. Therefore, create the socket file in the default temporary directory of the operating system. Keep the temporary data directory etc. in the build tree.
2014-07-03Support vpath builds in TAP testsPeter Eisentraut
2014-05-06pgindent run for 9.4Bruce Momjian
This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
2014-04-15Add TAP tests for client programsPeter Eisentraut
Reviewed-by: Pavel Stěhule <[email protected]> Reviewed-by: Erik Rijkers <[email protected]>