postgresql/src/test
Tom Lane d09f765b9d Harden TAP tests that intentionally corrupt page checksums.
The previous method for doing that was to write zeroes into a
predetermined set of page locations.  However, there's a roughly
1-in-64K chance that the existing checksum will match by chance,
and yesterday several buildfarm animals started to reproducibly
see that, resulting in test failures because no checksum mismatch
was reported.

Since the checksum includes the page LSN, test success depends on
the length of the installation's WAL history, which is affected by
(at least) the initial catalog contents, the set of locales installed
on the system, and the length of the pathname of the test directory.
Sooner or later we were going to hit a chance match, and today is
that day.

Harden these tests by specifically inverting the checksum field and
leaving all else alone, thereby guaranteeing that the checksum is
incorrect.

In passing, fix places that were using seek() to set up for syswrite(),
a combination that the Perl docs very explicitly warn against.  We've
probably escaped problems because no regular buffered I/O is done on
these filehandles; but if it ever breaks, we wouldn't deserve or get
much sympathy.

Although we've only seen problems in HEAD, now that we recognize the
environmental dependencies it seems like it might be just a matter
of time until someone manages to hit this in back-branch testing.
Hence, back-patch to v11 where we started doing this kind of test.

Discussion: https://postgr.es/m/3192026.1648185780@sss.pgh.pa.us
2022-03-25 14:23:26 -04:00
..
authentication Make new authentication test case more robust. 2020-09-04 21:01:59 -04:00
examples Update copyright for 2019 2019-01-02 12:44:25 -05:00
isolation Fix risk of deadlock failure while dropping a partitioned index. 2022-03-21 12:22:13 -04:00
kerberos Add more $Test::Builder::Level in the TAP tests 2021-10-12 11:16:30 +09:00
ldap Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5. 2021-10-19 11:15:45 -07:00
locale Make sort-test.py Python 3 compatible 2019-01-04 11:23:24 +01:00
mb Fix MB regression tests for WAL-logging of hash indexes. 2017-03-15 07:25:36 -04:00
modules Avoid using ambiguous word "non-negative" in error messages. 2021-07-28 01:24:24 +09:00
perl Harden TAP tests that intentionally corrupt page checksums. 2022-03-25 14:23:26 -04:00
recovery Fix "missing continuation record" after standby promotion 2022-03-23 18:22:10 +01:00
regress Try to stabilize vacuum test. 2022-03-23 15:08:20 +13:00
ssl Fix failures in SSL tests caused by out-of-tree keys and certificates 2022-03-22 13:21:48 +09:00
subscription Invalidate relcache when changing REPLICA IDENTITY index. 2021-11-16 09:05:51 +05:30
thread Ensure link commands list *.o files before LDFLAGS. 2019-01-02 13:57:54 -05:00
Makefile Revert "Allow on-line enabling and disabling of data checksums" 2018-04-09 19:03:42 +02:00
README Add TAP tests for password-based authentication methods. 2017-03-17 11:34:16 +02:00

PostgreSQL tests
================

This directory contains a variety of test infrastructure as well as some of the
tests in PostgreSQL. Not all tests are here -- in particular, there are more in
individual contrib/ modules and in src/bin.

Not all these tests get run by "make check". Check src/test/Makefile to see
which tests get run automatically.

authentication/
  Tests for authentication

examples/
  Demonstration programs for libpq that double as regression tests via
  "make check"

isolation/
  Tests for concurrent behavior at the SQL level

locale/
  Sanity checks for locale data, encodings, etc

mb/
  Tests for multibyte encoding (UTF-8) support

modules/
  Extensions used only or mainly for test purposes, generally not suitable
  for installing in production databases

perl/
  Infrastructure for Perl-based TAP tests

recovery/
  Test suite for recovery and replication

regress/
  PostgreSQL's main regression test suite, pg_regress

ssl/
  Tests to exercise and verify SSL certificate handling

subscription/
  Tests for logical replication

thread/
  A thread-safety-testing utility used by configure